Example of a JScript $ [$ B+ C+ r: Q) M$ ~' I
var vbOKCancel = 1; ( P g: r9 ~/ n' n7 k& D$ R
var vbCancel = 2; - v" G2 r+ c7 ]2 \
var vbInformation = 64;
$ F( h$ N9 ~- o: X. evar Finished=false;
$ V. V3 z+ M6 P* j: b% s' D& l
0 S8 Q/ ]7 c6 `$ D$ Y% Gvar WSHShell = new ActiveXObject("WScript.Shell"); 4 l. h/ V: O6 r
3 O+ G" u2 V K
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 n0 ~; G1 G1 i
& ?2 k3 P' D; E" t. ]8 }' esimple.SetLicenseType("Runtime"); * b4 Q7 W' p* N
' O+ m+ Y7 X! Q+ U% C0 O) Ptry 7 }# e; Y5 }" h u3 h3 A
{ % ?7 r. d& w! o. e* V
// Enter the path to a model file!
/ n* Q1 b6 t2 @; ^ simple.LoadModel("C:\\Models\\Test.spp");
9 z* X) G4 b( ]}
3 f9 _/ g5 t: J% `9 fcatch (e) % j; ^ f+ n L }# C
{ % C. J& c' [" Q6 y, ?/ V
WScript.Echo("Could not load Model!"); 5 m% s9 a) f- U( m$ B4 R( J1 Q+ C
WScript.Quit();
7 z5 a, k( P1 y7 F7 ^& e6 B; i} % d1 S6 g: j4 P5 x
B* W5 T# F8 c' b( Ntry ' f. D' i m4 ?0 E
{ 3 E% Q( c+ c* F1 E5 S& X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' T. m( N; c7 v9 }( ], a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % r2 l |+ D/ D; X, \9 u0 Q
if (r == vbCancel)
) q$ T G% a3 L* w {
+ J$ u! t0 \( R5 V( h/ l4 F1 R) ] simple.CloseModel();
3 e( L; N# X1 ?! I& f WScript.Quit(); 0 o; k+ S% V( M& f
} 0 r8 F8 {" |( l ]
}
7 }1 _; [8 n& D1 Y7 D& x/ J5 p
# D; ]7 s8 F7 ?+ f0 T& z. H6 usimple.StartSimulation(".Models.Frame.EventController"); + K0 U! ?! x% J) F9 q- L: M
' r% U) Z, {& L3 k: nif (simple.IsSimulationRunning()) t) J& w0 H# z7 |1 H2 r
WScript.Echo("Simulation is running!"); ( O2 M1 j: P. b) Y0 F+ t
& X4 t ?& J. p6 W2 r) F
// Wait until simulation is finished % ~5 A! b$ V) s) D( q0 ]
while (!Finished) WScript.Sleep(2000);
/ F! U" l2 v3 x4 c' R8 Y+ P* N) \
9 ^& f) U' A [$ ~simple.CloseModel();
9 G+ T9 U% o9 P+ v! G$ ] G! Bsimple.Quit(); 6 Q; Y! @, I& u% l: C
WScript.Quit(); , I' [- ^4 J) g, [: x, g
. |( d# G4 V8 A5 b5 G0 Q; H % j8 B; s$ K4 P5 F& B. w* Y( P
function RemoteControl_SimulationFinished()
% s: H' q7 A5 r% `{ : \; m! U+ ?- \/ T2 i
WScript.Echo("Simulation Finished!"); |