Example of a JScript
5 I( p6 o( a% d ], Cvar vbOKCancel = 1; 8 @+ j3 b: V2 d. V6 Z' W+ z
var vbCancel = 2; / C4 r' C, N6 p! i' r
var vbInformation = 64;
& o! U# g5 i1 S( p9 {/ `var Finished=false;
6 |+ y7 L- w( D5 {6 Y 7 _7 H; u) W2 t2 C( b% g
var WSHShell = new ActiveXObject("WScript.Shell"); $ c2 |' m) a, C& A
) ^& ]* f7 b8 ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 R) N% O s3 u4 S _- O' I) \7 Z# Y" Z : V7 j+ |; ~ g2 X
simple.SetLicenseType("Runtime");
% v6 I* I' D. O1 G$ X7 E( Z
% B% E1 Z6 `- h# @6 [+ L- x" Btry 9 ]$ a& i# w9 S6 m; W8 o
{ 5 s+ q2 q2 m. ]- |' \
// Enter the path to a model file!
! T' {$ m: a* ` simple.LoadModel("C:\\Models\\Test.spp");
' i, g, n: \# p}
* j* m3 o5 s2 p3 m" }8 A' h3 Dcatch (e)
5 m" f4 \" `9 o' Z* p{ % W1 s& t/ }' P5 C2 Q2 }3 R# g0 c$ ~
WScript.Echo("Could not load Model!"); % Z. V2 K, A- i8 U% r
WScript.Quit(); 1 ?: q5 D; u0 X! Z2 I/ b
} - n8 b) A; F" b. @1 g+ n
. u# D; N g8 a) o- Ptry
. E8 y2 F4 k* Q& a) B' z{ + S) Y7 Y" z+ ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 C) G: J4 D! p7 e/ g; i6 K* {' Z6 C' R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 R8 S0 s* z' F- |3 R( Y
if (r == vbCancel)
2 P3 U' X+ E1 I { r. ~. M! W% {( q# Z% C) S0 i
simple.CloseModel(); 1 I; @* e g4 S) S6 S# b
WScript.Quit();
9 l/ a3 Y" f/ L4 Y }
1 H! Z5 d; |& W7 n8 ^' T} & U5 G! H \9 T; Z6 l- g
# ]/ E6 Y3 M2 Y1 Msimple.StartSimulation(".Models.Frame.EventController");
; ~+ [) O1 z4 \) w6 R0 R* A! b, ^
6 c7 T2 `5 `! W6 F7 }if (simple.IsSimulationRunning())
9 ]+ N0 g* |: L' @0 {: Q WScript.Echo("Simulation is running!"); 7 X# {) b' d2 G) q- N* P
# R. p S/ A% L! f
// Wait until simulation is finished ' N. f1 ~7 ?* B0 ~. s3 \
while (!Finished) WScript.Sleep(2000);
$ b; b) n; ?0 u4 Z$ O
% j. J) N; A% V( [8 \- Msimple.CloseModel();
) ?5 D" b( ~4 y) a! G1 lsimple.Quit();
9 `( q( }$ b8 G$ D5 ^WScript.Quit();
" |' z; B, f# i2 C; Y7 ~ + |9 O }) r- M, {( ^
2 _ j, }7 A7 i9 E. ^- Rfunction RemoteControl_SimulationFinished() # k0 O/ w: k) n1 J5 w
{ : {/ n& i! j' ~% g+ b) V1 V
WScript.Echo("Simulation Finished!"); |