Example of a JScript
/ j. E1 D$ q. h. k8 X2 Pvar vbOKCancel = 1;
& @* L: q( H! |! [* K& Hvar vbCancel = 2;
2 k$ \ x. t# m6 uvar vbInformation = 64; * y" i* X/ h! _, y$ ?
var Finished=false;
, h# z. t. ?: S
0 f) Y( I+ ^- t) p& S( F: J2 `var WSHShell = new ActiveXObject("WScript.Shell"); 9 Z' n2 ~4 g! E$ U
7 E! c) l. \1 s: R3 Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; p1 ]: u4 G4 A4 H! b
/ U. ]. A% f' {simple.SetLicenseType("Runtime");
- H8 b5 S* R3 C. |0 m Q: o ) J) o5 J) W; U$ c+ R
try
4 N* d- p8 @6 X% x" N{ 1 F( u1 W9 g% c
// Enter the path to a model file! * }: Z" S( z2 v9 u" M8 _) J
simple.LoadModel("C:\\Models\\Test.spp"); 1 W7 F1 d8 o+ C1 B
} + K' B, V+ {- c$ G3 z' F
catch (e)
% S4 T, B9 ~ A4 E& Y" h$ K8 J{ ) u" o' o C5 k9 s. Z
WScript.Echo("Could not load Model!"); # s* L! c& {1 D+ x& M: ^
WScript.Quit();
) j# f% `4 I. j3 k5 B}
. o' d1 q* a/ e% @+ i5 h* w " ?/ @/ d: W9 D$ [/ N) q
try
9 E6 v& t, w4 j: M6 X; o{
: P! E& s; o( _/ G simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& r2 G1 }# M7 f r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 5 g" G0 P1 P! e5 `# ?
if (r == vbCancel)
0 K! \$ E4 d0 R5 q) b0 G9 u {
( @% F& G: U$ P) \ simple.CloseModel();
, ~. `& S* a, g# r# \- y4 T- O/ l/ b WScript.Quit(); 7 \' i( C8 @; P6 c* g/ X
} 7 T) j+ u( S W4 j1 o9 Q
}
. [: z. p$ u" s& E! S! o6 t , {0 I" L& J; m6 J
simple.StartSimulation(".Models.Frame.EventController");
+ K1 n+ P V Y
6 }3 z1 t' Z2 Xif (simple.IsSimulationRunning())
* j# B( O7 k2 C+ X g9 Q. y WScript.Echo("Simulation is running!"); 2 C# [: M% \9 R' t. A. ~
) l' @9 }2 z% N$ |/ l0 g// Wait until simulation is finished
* [2 Y4 u5 t" C1 d fwhile (!Finished) WScript.Sleep(2000);
" g7 K2 d2 M1 P- S! @2 o5 Z . F( c& U" e8 \8 ]6 n# ]
simple.CloseModel();
5 Y1 L6 w' F9 y2 @0 msimple.Quit(); 9 [* z5 c. J' B( [9 k! Z
WScript.Quit(); ; |+ h6 @1 q* R5 T8 d5 T O
/ l7 r& {6 O7 O( R9 Y. C
( T2 o4 `; z0 Vfunction RemoteControl_SimulationFinished()
- I+ G1 c9 D9 O! ^/ q/ A6 d{ / H2 j8 [' U) D
WScript.Echo("Simulation Finished!"); |