Example of a JScript
8 ]1 q: G8 h& Y3 f' }var vbOKCancel = 1;
3 ^! x9 P- [* cvar vbCancel = 2; : I) F3 t5 A7 u
var vbInformation = 64; ! i( `, a( j/ N: ^
var Finished=false; + Y! f9 a! X' c+ L* u# x
& @9 I: Z% {; x" @# z' J
var WSHShell = new ActiveXObject("WScript.Shell");
+ i" t4 h, q2 W
. t& D- |1 k' T ]! K( d+ O9 P( tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, l; ], V: P2 u& ]4 M# \
# k4 l$ } w8 T0 k% g4 W3 M; Tsimple.SetLicenseType("Runtime"); q% A6 s/ F2 T0 J2 L: Z8 d
* P1 m) m- v6 ?
try
" s' V8 d0 W" i: z. x1 L. d7 l{ ; L, @( s9 A' F0 e" d9 R
// Enter the path to a model file!
' [! U( _, N9 p R0 _$ L9 X simple.LoadModel("C:\\Models\\Test.spp"); e- _$ D2 |: U$ j. @. D6 j
}
~2 h# k& C V" t; n, \' p' icatch (e)
" P8 }1 {: I8 \0 ^& S8 |{
1 [- ~7 H. Q' ?7 g# U% |$ q WScript.Echo("Could not load Model!"); 6 z" g7 m: M% v
WScript.Quit();
7 i% e. u1 ?1 ~1 }}
) ^/ ^* m9 @* G* X6 l , j; H5 `5 v6 k2 w% D+ y$ C
try % r7 ^7 D+ ?7 y* k- l" U
{ 8 `! J! |* s& @' K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 u9 I/ O3 ^) n1 q. @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
?* p9 C; O; ~- R* P9 I; n8 Q if (r == vbCancel) / ^) E+ G( a5 {# R
{ / w" B3 J! F# X# [ A
simple.CloseModel();
8 F: N9 l8 O5 m2 m, |7 r5 n& } WScript.Quit();
0 g9 n" K! S7 X1 a5 U1 a } . D" g) ]. y6 t* M l$ L
}
, \( c( I/ ^; E" j; p- h% n w4 W9 C 3 j' g; l- Y) Q0 V. @
simple.StartSimulation(".Models.Frame.EventController");
$ P4 d; d F2 X3 `$ E+ k( Q& a
/ E# W6 C. n' w5 Oif (simple.IsSimulationRunning())
8 e, }, H! O. w" b8 o# R WScript.Echo("Simulation is running!");
& a3 P. L$ K' a8 N0 B {) @( e
/ O8 S* e, W/ |$ v/ P0 q// Wait until simulation is finished 5 K- g/ V$ ]8 \% L' ~% K% P8 P
while (!Finished) WScript.Sleep(2000); + U4 t6 M9 a! L
* M. T; ^ |4 w+ w9 H/ t9 C
simple.CloseModel(); % q- d. }& o* G. u4 O
simple.Quit(); & ?0 L- r. [4 G
WScript.Quit(); 0 ^. O5 a9 h; ^3 D: D! W) c
' Q) r& b. F3 z* P8 {$ v0 u. \ * b) d9 c: G% T& e& Y
function RemoteControl_SimulationFinished() ) p& q5 o: `+ A- r( Y1 s# M* A
{ - G4 [ t2 N9 G0 t
WScript.Echo("Simulation Finished!"); |