Example of a JScript
; P2 M% t0 \! @+ \0 yvar vbOKCancel = 1; " C9 q7 S( @4 w0 ?- `# f
var vbCancel = 2; 8 I/ B5 J3 `& J8 P3 @9 s5 Q* h
var vbInformation = 64;
3 G. J5 ? a1 g' Z! Jvar Finished=false; , S% T! @% k$ ~8 Q0 T ^. \
& h; t6 v, n! v- I& G
var WSHShell = new ActiveXObject("WScript.Shell");
" c$ B- G4 k- P' u0 r: Y . l* S u' E" }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! N ^: k0 P D6 [: M
: f2 Q7 d7 \9 nsimple.SetLicenseType("Runtime"); ) P5 Z' W7 n; Q) F3 w) k
0 x" m8 J, G7 g! G! ] i$ Gtry
; [* o) K% O) F9 P{ ' ?6 n* _' `1 J+ T" A4 K* h* P8 ^- S& I
// Enter the path to a model file!
1 O0 I" O; O+ ]/ Q4 w9 T- F simple.LoadModel("C:\\Models\\Test.spp"); , T6 [6 ~) q! d
} 9 l* p d/ H& d2 L6 U7 g) P
catch (e) 3 m, a% s2 K% b. h c. k
{ . _. Q5 Y; U/ H1 E/ V: E
WScript.Echo("Could not load Model!");
) y: T2 n7 c, P5 E2 X' V WScript.Quit(); ; b; z9 H1 e8 m* M7 U
} 0 @3 M K G- h$ ]
. Z1 [* \ L# O% i3 r m) c9 ], t; Atry : R% |8 l H8 c5 y
{ " H7 x$ l/ K/ t% I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- a4 v/ o: Z \ l3 e r0 u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); t, N" B( V2 ?. Z' U, w
if (r == vbCancel) # ]* i: m- |+ x- G3 V b1 r
{
% @' P( N+ B# u0 n simple.CloseModel();
+ Y b+ i; A4 V" _ WScript.Quit(); . V- r9 C5 q- |5 d+ ]
} & j) F3 P# q/ l. n
} % ^1 x3 l4 |% G: L* y, l
2 R" X! w+ Z& r9 Q4 y
simple.StartSimulation(".Models.Frame.EventController");
y9 l6 q. s3 P5 i* q4 W1 n0 ?
6 @1 p' \- n/ ?5 W' Yif (simple.IsSimulationRunning())
7 i+ I0 b9 H/ S6 R W! i WScript.Echo("Simulation is running!"); ! W& ~- T9 M$ |
; [3 s& H! N9 u( K X, [0 U$ a' K! @// Wait until simulation is finished ' @3 r6 }$ q c
while (!Finished) WScript.Sleep(2000); : l7 M+ R# R. v, L: L; s1 ^% q
6 ? _6 b& p" T6 \: p+ o! S. ~
simple.CloseModel(); 6 t2 ~) `' t. P( g2 ^7 T
simple.Quit(); . T3 }, e" [& L+ h1 e+ h1 v
WScript.Quit(); : t1 i( B, b. n3 v. R
2 f3 M* u0 \$ D7 ~, c4 ]
( S g2 H% v4 m3 g: gfunction RemoteControl_SimulationFinished()
7 }' Q! `4 u8 ]0 `9 S l5 Z{
n0 l) X6 q& T9 u7 g6 f) C0 w3 m WScript.Echo("Simulation Finished!"); |