Example of a JScript
. O* h5 V( T) j0 [: vvar vbOKCancel = 1; 0 p y* @ i# A/ u7 I/ Q8 S/ f
var vbCancel = 2;
8 h/ x: g' B/ ivar vbInformation = 64; & v- X3 O" F7 B
var Finished=false;
7 P: i$ T3 ?( O( Q& s2 z& e5 v
& i* A* x' ^, g# P! U- }var WSHShell = new ActiveXObject("WScript.Shell"); # u1 ~3 d% x- [5 V
5 ]+ x4 ~% S, h8 k( C7 t+ S7 ]
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # t" o# P: I! R0 G
7 ~: G$ c- h p) O& b
simple.SetLicenseType("Runtime"); * U: E# T) r |# ?% `! w- h& h& `
7 N( L8 x9 E3 j& F8 T8 ]7 s
try
2 [. w- f, p) W# e9 }1 O& C{
) y$ @( g4 L" k, W8 X // Enter the path to a model file!
% R7 D3 ~0 `* C$ q4 u8 u/ ? simple.LoadModel("C:\\Models\\Test.spp");
$ e; H1 \2 t7 y |) D& A/ P}
8 s: o: v' G! L" q1 l0 Q0 } b5 ?+ i" gcatch (e)
1 b$ Q5 c/ q" B{ 1 @' H$ d/ P; K7 k& N) _; d8 w
WScript.Echo("Could not load Model!"); & ~2 m% k; f! R; e. L7 t
WScript.Quit();
) A2 x# L& n/ @6 N- w: i+ [: ?% h}
. K9 P8 i: }3 I. P X* J, N' N- C+ l; P2 n. E6 J
try
' H7 [" R( ]. F7 e0 Y9 z* p{ , v$ d* u; n% Y" ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 |2 k" G0 n" b" M9 L% {; k! a6 n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ `( d9 C+ ]- @& j if (r == vbCancel) . E* c! i# i7 r m9 _4 C& g2 n2 P
{ 6 x4 d/ Y+ X: q( B" u: Z. U
simple.CloseModel();
* s* O5 N( d. w9 {* p9 f WScript.Quit(); ; R: L0 Y5 C9 q9 H! J
} 9 I" @, `7 N4 }+ A0 S
} 1 @# l5 K+ ^! o) @3 Y" l0 {2 _8 R
* D7 Y; @; p6 Q. ^2 N
simple.StartSimulation(".Models.Frame.EventController");
* J$ n7 u( |6 p1 P; S
+ \/ t/ V* T$ Z! Pif (simple.IsSimulationRunning()) 5 ^( n8 ^- ~1 Y& u
WScript.Echo("Simulation is running!"); $ i8 J. F" D. n0 g% f
6 |3 s1 i% f- _' a% h
// Wait until simulation is finished " m U" B1 t7 W6 U; q$ e+ X
while (!Finished) WScript.Sleep(2000); ( U/ {' K* I! e
3 }7 Y3 V' M& ~- Jsimple.CloseModel();
v, [$ D) Q& Z( [1 H8 n4 X* Bsimple.Quit(); : C/ v$ A* t: @
WScript.Quit();
/ T* R# {2 c8 r; ^/ Q# Q: K
6 J3 I+ q) T: c 9 _+ w7 ^" M& v" f8 ^) {+ w6 R
function RemoteControl_SimulationFinished()
1 v+ P6 M8 F2 B8 R) P0 M( p4 Q{
; u$ m. J% `+ h: K4 B7 g WScript.Echo("Simulation Finished!"); |