Example of a JScript . C& e/ H4 Z6 n$ K B
var vbOKCancel = 1;
6 J- C" q) x- {) @var vbCancel = 2;
4 @2 r, z) _$ T+ S: {/ cvar vbInformation = 64;
: }. x+ H2 @* x- Jvar Finished=false;
. C: q: q( i; Q+ U+ M 6 |$ `7 \ Y7 f
var WSHShell = new ActiveXObject("WScript.Shell"); + v; r+ P @2 b7 F* P4 l1 i# M
! Q7 W; ]0 ?- e& Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - D8 d# |7 ]$ ^% Q2 e- C
3 z; W; b9 O. f& x7 n+ } K& D* zsimple.SetLicenseType("Runtime");
4 A* L" m) s, j3 }, O ( D$ o* S- Z8 i l3 T. R
try ! }# t0 p; H V$ S, `7 \5 _
{ 5 O) t* {6 f4 {
// Enter the path to a model file!
+ J* Y2 p8 ^' S$ p8 l% ]' o. F! w simple.LoadModel("C:\\Models\\Test.spp"); : K1 c1 L \/ M; J; @' z
} + `! ?' U$ S7 s& G
catch (e) 2 `( f, N+ F' F& S' ~
{ 2 B1 |+ ]$ _6 A$ Z( e
WScript.Echo("Could not load Model!"); " n/ i5 w% Y; p N. W
WScript.Quit(); ; a$ F. T$ B: P5 z
}
* h& F4 o" t6 n6 p) k% y" z$ E
/ t4 d" O% O' U: g, Z, ytry 5 D+ D( i; y1 U& @1 p1 B
{ . I/ |6 |3 U' b7 y; X' W% [/ i* h. Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , B; Y# u; g& C# [. y3 s e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 \8 ~" l& H4 @ if (r == vbCancel)
# k* M2 R) u) C3 } N# G* W- m5 A { 7 V+ w: ~3 `! P& f* C& D& v, g
simple.CloseModel();
: Z) V3 N5 S5 L# d# z4 m7 p# | WScript.Quit();
3 J2 ~4 n+ u; ~, f- ?2 h4 A } # Z( r, B5 I# C" }+ g
} 3 G7 R* N* V1 e) J# |5 s' g
0 _3 c. I- \. t
simple.StartSimulation(".Models.Frame.EventController"); 8 I2 C% l& y0 ]; F. |. W
* J* `3 H g3 }
if (simple.IsSimulationRunning()) % _. u6 v# T, E# w/ t: t3 V! p |
WScript.Echo("Simulation is running!"); + v1 c+ w* V! c) f$ m& {, W! s
$ O+ x. c+ K% C9 @// Wait until simulation is finished + d" U5 a! B( w- J9 K
while (!Finished) WScript.Sleep(2000);
: V5 N, F+ K$ B! d4 q3 y
7 u7 D' W5 @4 \' O1 T: Z5 {simple.CloseModel();
9 m$ Y+ h) ^ L0 H/ w7 R" ysimple.Quit();
* \# p2 M9 s8 d2 p0 e' JWScript.Quit();
! R6 _& L" d0 \8 O
% U' i5 Y) m* g0 t& @+ \# B
. x$ F" C0 u6 `; sfunction RemoteControl_SimulationFinished()
e% O; o2 K1 B' [. X4 g{
1 ~, {' n4 T! i WScript.Echo("Simulation Finished!"); |