Example of a JScript
0 K t1 O5 r# _ K1 R( a1 Yvar vbOKCancel = 1;
( q) i2 F! M) m( ~% R+ kvar vbCancel = 2; " W1 T% t2 d1 [
var vbInformation = 64;
1 s3 w" d5 A5 X6 @var Finished=false; 5 Q; M7 F* M2 V! y+ f3 {$ Q/ b: n
3 e3 _1 w3 \3 x8 H% f
var WSHShell = new ActiveXObject("WScript.Shell");
4 n1 i+ L$ H6 P6 v* M7 V# m: O! d ( O. n7 W8 X) j/ J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 \- a. o0 l+ d3 ?' b7 v
1 [- N- q4 }4 C0 O) c/ k0 q) u( e
simple.SetLicenseType("Runtime"); ) Z" R( ]" V: n6 |# K$ O4 T' A3 V
- d( e' X( b5 |1 T& I+ f" etry 0 e3 r, f1 C6 M. T
{
* x3 d9 b/ Q- q/ {6 p& r // Enter the path to a model file! ) z( J5 ^2 D5 z% Q, s$ N
simple.LoadModel("C:\\Models\\Test.spp");
: q; i+ r2 Y" \4 B9 N1 E& i: j, O} 5 Z4 Y& c' u* s8 i
catch (e)
' F) \/ w* m/ Z% A9 E+ z" @{ . t4 s# J" d5 x2 O4 |5 k O
WScript.Echo("Could not load Model!");
: r3 z+ K4 \: Y$ v7 @ WScript.Quit();
$ h9 ~/ X( A+ @& x1 R}
/ j/ S7 c' D) r. N# J0 C- } + j# T! y( M/ f" Y
try - ], d+ ?/ ]& i( x+ W
{ ( v' z8 j5 `& M9 `# y0 o) s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 _7 H+ N* h* e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) l, d+ h# D; N3 z6 P; F$ a: G if (r == vbCancel) ' T2 j$ a2 t/ W# u1 C& C! X0 Y2 v
{ ; P {8 O. n, a3 I9 A
simple.CloseModel(); * m `$ V: {5 \* C l. r {
WScript.Quit(); - I" D ` I6 Y/ P$ x* p9 |( t) T
} + b4 ~- B6 x3 b$ j7 X
}
4 Q$ N: z3 p6 V( `3 [9 f) a $ k5 x* ~9 f; _! \1 G! E
simple.StartSimulation(".Models.Frame.EventController"); . r/ A, D" Z1 P1 ^2 K! `* \
9 ~1 L$ ]0 V2 J: Z" Q) Pif (simple.IsSimulationRunning()) X/ I3 |* Z) Z* |- `8 |( O- g0 R
WScript.Echo("Simulation is running!");
0 q5 {% X$ x& U9 p& i - X. \4 |# x2 ^( k! S# o) R& s
// Wait until simulation is finished / L$ k; t: S# R' D
while (!Finished) WScript.Sleep(2000); # a! H2 [. e" |9 ?. U2 g$ n( z
^6 y3 c8 @9 ?0 Y" h1 g
simple.CloseModel(); - D; `0 K! S1 R! i: n
simple.Quit();
( ^8 Z u2 h- x( nWScript.Quit(); q. D9 R7 ]1 `+ P1 Z2 `
9 F: Q# H( I, P; q
& o6 F# Y7 Z; B6 X8 ^8 X5 t9 cfunction RemoteControl_SimulationFinished() 3 \" O5 v* K$ @ ?: r) J8 M
{
2 \, a5 j& l8 h WScript.Echo("Simulation Finished!"); |