Example of a JScript + {) `, C# D; e7 o
var vbOKCancel = 1;
% u" E% k3 w% |var vbCancel = 2; ) \/ E2 d/ b; }* h8 G
var vbInformation = 64; 5 U9 ~, \/ D2 d! i
var Finished=false; : P2 a+ q. p0 E' Y1 c
! Z* ^& |; v" n8 e7 qvar WSHShell = new ActiveXObject("WScript.Shell");
% K/ f, @9 k+ A8 u) [5 U
' Q3 ], m- v2 t |; @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 e+ k+ N, w2 `+ ?0 t
+ F9 v5 `" M; J* p7 r. ksimple.SetLicenseType("Runtime");
* K" C; L( I) K+ [ S/ V0 r 1 p( z3 ~* N3 ]5 d* {* V: W' R
try
9 n: P. S& }8 P3 r+ P" N: L{ - a. x" V/ d1 P/ l6 M
// Enter the path to a model file! % r2 z" ?+ r# C& ?4 F6 j* Q9 d
simple.LoadModel("C:\\Models\\Test.spp");
; d8 E# }$ P M, P" J# Z} 9 @# `% U) v- w4 A
catch (e) . Q8 s$ r6 x! k) @% T% `
{
5 g% ]; K9 W5 Z/ o WScript.Echo("Could not load Model!");
& m. ^+ [+ R8 D. ~ WScript.Quit(); / w2 N, _# s/ J4 `0 l) M
} + @ g5 `' J# s+ e
( p h5 i x B+ H, E" _( j0 Gtry ' _! p2 A. v" q
{
& ?8 B+ O& s7 r5 o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ {8 h, d3 q: A* X1 x" Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ s) G, ?+ d( m if (r == vbCancel)
1 E4 c- h" Z' F0 u# ]+ y& p { 6 R4 e( }5 j( ]% \2 e* w. A
simple.CloseModel();
+ o0 w; p( ?! f/ W% j! l WScript.Quit();
( D- ]% r' n4 W* K6 k9 ?& m } 2 G' v& b- {; w% e9 N4 ]
} 6 @ N8 Y- d* b+ r% K% `
( q. K! a4 ?6 z* q
simple.StartSimulation(".Models.Frame.EventController"); " ]5 Q, u% g: h R! N+ U
) W( a: {# S% b6 H# q) Hif (simple.IsSimulationRunning()) L; {" _+ O0 s$ j" K4 t4 p# ?
WScript.Echo("Simulation is running!");
( o& W8 d; l+ ?% M* Q3 A5 ~
' K% s$ k u0 [) K% K$ ?* T: z// Wait until simulation is finished 9 a! i4 Y+ r1 U+ ^3 o
while (!Finished) WScript.Sleep(2000);
/ b, h/ s# Y% P+ E' w
( u1 A- H; K5 M4 G O( P bsimple.CloseModel(); 6 X0 F- r \5 L" B5 d1 z; P
simple.Quit();
4 l- s) U' p: b; ]. \- j/ l+ |$ xWScript.Quit();
3 N0 r/ J7 s2 J6 x" l& }
! V, E' T' y R ! w5 B. p4 o3 Q4 R5 u$ {
function RemoteControl_SimulationFinished() ) [! M% c) B2 H0 ?& c
{
+ q/ f$ ^% P. ^/ E. s* X- L WScript.Echo("Simulation Finished!"); |