Example of a JScript d* R( g* V1 u! E4 M. A/ d% u4 R
var vbOKCancel = 1; ) G# e2 B& V6 g- j* }" u
var vbCancel = 2;
6 z( B7 M: X" w L! [; Bvar vbInformation = 64; 7 E' H H# p0 N2 n
var Finished=false; ! m" E) ]3 Z; |5 i
+ ^, l* O: Z7 u: x9 {var WSHShell = new ActiveXObject("WScript.Shell"); ' l, Z1 |9 i. \. ]9 L
( U+ p+ [0 D- |3 v7 b, z& k0 S1 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - m- B ^8 {7 p/ d8 w3 w
4 C( T1 n1 H: l2 i+ ~0 T/ w: B7 t. Isimple.SetLicenseType("Runtime");
* _% l5 G A: J! _
9 p, H4 ~2 V! D# D, i0 htry 7 J$ r4 e, L2 X/ e7 ]3 w7 F1 P8 l
{ : `9 I# q7 Z: E- r; u( q. ?5 @
// Enter the path to a model file! 0 Q+ c* K" l- D6 r2 D
simple.LoadModel("C:\\Models\\Test.spp"); $ j, v- ]4 J- t5 @, M( ]
} 5 e' v6 N2 h0 k- D) _! G7 h; K* g, n
catch (e) & |" a5 f. d+ n$ m2 E
{ / ]& |9 u. p& p5 ~$ e
WScript.Echo("Could not load Model!"); " t7 s1 |2 S" ]6 W! E0 L7 N/ n
WScript.Quit(); # _( O. z: O: ~
}
; v9 O/ G4 V* t5 F9 Y
4 e+ N. ?: d) a. }; p! Rtry
9 A& i% R4 l; _" _{ : r M# w( \- P$ H- d& V3 d% I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % P( f- k: A* f. Q- W
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 o! i) ?% x f& R if (r == vbCancel) % u9 D9 C: L1 I' M1 S6 j6 C/ [
{
4 ^* |& n; G% ^+ P8 F simple.CloseModel(); 7 L! M' i. T" f" m
WScript.Quit(); 8 w0 E/ g7 H4 I& ^% W5 H! X
} ) h) P1 F6 V, ]1 b( f8 r" q
} 6 F) F+ t+ ]! F" o
{- X+ G# e; x3 @! C
simple.StartSimulation(".Models.Frame.EventController");
w" Y2 O( b( ?7 q( Q) J
3 U0 L" j6 Z0 J2 b& qif (simple.IsSimulationRunning())
; B' k/ O, W+ T# d5 F& R! V: [ WScript.Echo("Simulation is running!");
J5 u: ^2 B- G8 O
/ L/ w G! a0 m& u// Wait until simulation is finished # s" B, E. z0 l; n0 j, u
while (!Finished) WScript.Sleep(2000);
/ x* d$ x1 u0 Q6 N3 Q0 O! _3 T* m / {0 B8 P3 c. l$ h* F3 m
simple.CloseModel();
3 G1 A: c- K- M! C2 T D4 Ssimple.Quit(); & Q4 l& B5 L) _: M1 q5 K8 h9 X- {; w
WScript.Quit();
# K' T" U7 l; M g! c" B/ B8 K( k # z- b2 y) i8 ^( I8 U- i
5 u# g9 e$ X/ y! g
function RemoteControl_SimulationFinished()
+ j7 H0 \/ P% |' n( Z# v. T- T{ & U5 C0 X( I' Q
WScript.Echo("Simulation Finished!"); |