Example of a JScript
- m) q; j( Q. Y0 k' F+ Tvar vbOKCancel = 1; - {+ b0 e7 g( Q
var vbCancel = 2; ; m+ A+ ^$ t2 M3 Y" L
var vbInformation = 64; 8 w2 V1 N: Y& ~/ K, N
var Finished=false; " q5 ^! H0 g8 c5 L/ n5 }
6 d, Z+ B( ^4 Qvar WSHShell = new ActiveXObject("WScript.Shell");
% M2 r* r+ O! h9 a: N2 t 8 g1 L0 l! S4 R1 y0 T$ \' F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* L# h8 e- Y2 Z) e& w 6 [, l- q& Y2 A$ G8 e! r; ^
simple.SetLicenseType("Runtime"); 9 s. W7 Y- e: Q$ e
' M1 m9 Z( K0 e! [* g
try & a5 t6 m |3 k5 V
{ / r$ N/ \7 n. q4 a
// Enter the path to a model file!
" g/ q7 h6 q: C; [3 i simple.LoadModel("C:\\Models\\Test.spp"); 7 K7 j# l% T& b5 C1 l% x
}
+ X9 V6 V0 z) c! ]: p5 l$ Y. j. P; acatch (e) 7 Q+ [8 H5 _0 C( \# y0 g# \
{ g. K/ y. i; v- `3 v0 j
WScript.Echo("Could not load Model!"); * h# B0 t, c" U' Y" y/ j. I
WScript.Quit();
8 g% L3 s- l, D, H9 E9 ?5 M} % ^ q& ], A% ?. h9 V B
! h y: |4 ^* Q/ {$ V+ ]8 X! \
try
8 e, `4 Z. U ~' I$ p7 S( Z; {{
/ H4 \8 p6 y" h8 Y. D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 n9 R; ^7 Y# K; r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ M% e) @9 j2 m3 K( O
if (r == vbCancel)
0 t# T/ R. f4 a2 J { - N o# Q: y" O- d: k( _% ^* `8 t
simple.CloseModel(); . O. z7 x0 X$ W5 M% ~+ _
WScript.Quit(); j$ i$ l* ^3 q) k0 _
} / k0 P( Z- Z: K" H2 N6 V
} ! J2 W( w% G5 `. T h( V
x& C3 P% I- f) e E# Z
simple.StartSimulation(".Models.Frame.EventController"); . b$ K& R: h- j O/ @- s! l% k
' h' N" Z2 r6 B% G( q4 o# s+ tif (simple.IsSimulationRunning())
* U& ~. E; K$ a# {7 t; t, [7 q+ \ WScript.Echo("Simulation is running!");
% B$ v, K% ^# y7 G9 d2 d' J6 i 2 c' U2 ?) j: h9 E4 b; h8 f
// Wait until simulation is finished 4 c+ I- O0 ^. w5 b5 R
while (!Finished) WScript.Sleep(2000); % ^2 O( J) M6 {! w% L" @
6 K4 M x, W2 u) O! j; A7 N+ n
simple.CloseModel();
0 ^4 h5 y$ \( B' qsimple.Quit();
# I( M# V3 W$ r2 bWScript.Quit();
1 H! ]' F( m I+ C# ^5 w W; t % y t; v8 R+ D
2 i6 Z8 w8 H+ _$ ?6 R
function RemoteControl_SimulationFinished() * T) G- q( j _! O! [# f: q
{ 6 e9 \2 A# |% G; [8 g1 \
WScript.Echo("Simulation Finished!"); |