Example of a JScript : S: Y2 O* M* e4 R
var vbOKCancel = 1;
% j+ l- O. G2 U8 gvar vbCancel = 2;
( L+ ]. W6 w! c& f- |3 v- n9 ^var vbInformation = 64; # u- c: u o }" ]; F; m, ^! s
var Finished=false;
$ a& N- T# {& l
* [& U8 f" b) H6 j+ tvar WSHShell = new ActiveXObject("WScript.Shell");
" O0 C, v2 i' a$ P. I , ^3 o( J. m6 q9 _% {9 G0 B* x; U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * G( t/ r) l9 A9 ^; H z/ X
% d4 V! ?2 B' s; `
simple.SetLicenseType("Runtime");
$ f( V; B( r a; H9 U; g
/ _1 t) f5 j+ L# _' itry
! v+ Z0 z) k( V1 [0 R{ 5 r% N( Z/ N. i- g0 N: d
// Enter the path to a model file!
; B! O- S+ Q6 P simple.LoadModel("C:\\Models\\Test.spp"); 6 k. Q) n0 B# H8 s5 `( E( n3 N6 v
} " t4 ]& ^' S+ X
catch (e)
" [% \1 ~$ v; g8 K4 N{ " c# u8 B* @% I' S2 H, |
WScript.Echo("Could not load Model!"); 0 y' Z O# j H2 P$ b/ y _/ J% }
WScript.Quit();
, j( W% L! l' \} / E/ C4 V) Y' W Q) l( s& y% r5 |& V
7 U3 L* E' m$ K% ~" a0 \& U
try
& p9 n( S& B5 N{ ! O: ~! J2 p! p' A8 l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 R( x5 ]5 G) C" w5 |# K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' T; @! R" M$ e% G+ k) g if (r == vbCancel)
/ x* b( m) C( H- W { " p8 n/ ?1 B1 ]* ]/ i! |5 p
simple.CloseModel(); % s4 f, m. [* v& f
WScript.Quit();
$ L" ^9 j+ N1 n* R* \ } & U6 ~& i) C+ F
} * Z* m) I, O% k
: v1 ~* `/ Z% n; o+ K0 Asimple.StartSimulation(".Models.Frame.EventController"); 0 |1 i; J1 r( y, N1 e
0 f. |) {9 Y+ x! t$ {3 Vif (simple.IsSimulationRunning())
& T5 R1 O) `3 N9 v WScript.Echo("Simulation is running!");
; m, j0 C" z2 d
( x7 m L; ~1 g& V2 }// Wait until simulation is finished
! G r* q- C7 ]+ ~% a! F8 s9 ?# ~8 cwhile (!Finished) WScript.Sleep(2000); & ?$ E2 d1 s. m W- v5 c# X, Q+ w: S
( a" N3 R+ u0 {, T1 Ssimple.CloseModel();
) v% S1 w5 L) n7 b8 H/ v" ]" |simple.Quit();
2 o9 B$ J$ n% cWScript.Quit();
/ ?2 g }0 G# z+ u0 E# _1 e3 d
) s/ c# ?9 W- w: @$ b
0 s1 U1 r c8 s5 n) dfunction RemoteControl_SimulationFinished() $ q. T5 n# D: I* L5 \3 {
{ ) e" f1 V3 F/ o5 y3 h# c
WScript.Echo("Simulation Finished!"); |