Example of a JScript : n D( W8 a1 b2 B# x/ j- Y7 N
var vbOKCancel = 1;
6 q+ d$ `/ I/ c r- R2 vvar vbCancel = 2; 3 D; ~ l! d0 E' b4 Q2 L
var vbInformation = 64; 3 g; {$ }, O) n4 N% A* X
var Finished=false;
9 O( ?5 w* D; q2 R7 m4 p0 |6 Q * s' Q" D" ~/ g5 Y
var WSHShell = new ActiveXObject("WScript.Shell");
( L; \' b7 C% T# y3 ] & d# v; M; @( g3 I0 S- C
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 z! h! I3 X; y6 J
7 E* _- u, w# ]5 t$ R" K
simple.SetLicenseType("Runtime"); " v6 g/ | R2 U b( M: ]
5 a# O5 Q X) _5 Z6 D4 B0 e: S+ qtry
# W2 u8 d/ ^+ u6 J! g1 J( j{ ! E6 i' T" M; i. Z
// Enter the path to a model file!
0 ^* g' ]% I. U% Y) ^2 Y simple.LoadModel("C:\\Models\\Test.spp"); $ T; \; Z' d5 N4 u' H
} 1 Y2 K! c) B+ E: T7 ^- c$ e0 Z0 h- g
catch (e) 7 ^+ [) a7 s) u* n
{ . l4 E* S f& x& M% K% i
WScript.Echo("Could not load Model!"); 5 e% N8 {' r2 ]) m
WScript.Quit(); 0 V* P. `. b. S% q K4 b% D
} + W* G5 Y9 C8 _. ?' }3 f) M
# t6 R6 F8 o& s) xtry
" Y! }4 O" d* ^0 A{
0 A+ p* i( j. B' W/ @ A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , v( q( s! i; H; C7 S9 M( u
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% ]/ g' q. w5 H9 b; Q if (r == vbCancel)
1 ^6 h9 A1 C/ V# F/ g0 z { ( Y2 D- s* c4 s
simple.CloseModel(); , B, B' Q; s4 s" Q, j* r& B9 W
WScript.Quit(); % H) Z# ]$ t5 E0 h* l/ V
}
& \% ?( _+ g. |. g& i# l3 L} 8 {" m' Z# G* m
) ?3 R4 O+ v- e
simple.StartSimulation(".Models.Frame.EventController");
7 @- c! |2 S; k4 C% v3 b3 M . N9 C9 m. Q( `! T& X2 K2 ]; J
if (simple.IsSimulationRunning()) . C5 q7 E( q7 F$ W9 g8 E
WScript.Echo("Simulation is running!"); * m. |% N) O! G2 l
+ \% b+ j% q7 b% o// Wait until simulation is finished
7 d1 s1 N1 y! R. \9 \while (!Finished) WScript.Sleep(2000);
}* R/ w1 C3 o: ^/ s- k6 Q/ L % D$ N3 q8 m2 R3 ]: I, h
simple.CloseModel();
2 G t, U2 G' I) ~" y. usimple.Quit(); 8 T" M7 c" b- [' m
WScript.Quit(); 6 k& n9 I0 k0 F( [; r) @' P1 t7 [) Q
' G% B1 S+ T# o/ K, h7 s
1 G. E, }. N `5 B$ o
function RemoteControl_SimulationFinished() 6 G0 @6 v( S c3 Q0 |, @
{
+ _" {+ z/ H% d; [/ k+ s WScript.Echo("Simulation Finished!"); |