Example of a JScript * D0 k; s0 h) P% K
var vbOKCancel = 1;
" j+ m, L% X5 N/ y5 ~: x* J1 r9 `var vbCancel = 2; 8 R, A. f* C2 r7 X: P/ C* y s2 P
var vbInformation = 64; . Z7 R f( I) R* m
var Finished=false;
( R2 V7 |# D& Y * j& Z a0 c7 Y# b J% Y% z
var WSHShell = new ActiveXObject("WScript.Shell");
1 r# r7 L( \* L+ y7 A2 m
! d2 ~+ t! k! {+ w, Lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * e0 F4 Z: J6 |# Z! T
. V5 p* o3 I3 N0 B# t- R C- ~0 D
simple.SetLicenseType("Runtime");
: @0 V' _4 f6 |3 R! o3 l$ b
# u8 W/ k4 q8 B; l; u& e( X* Ztry 0 t8 S( s. { s. Y( @
{ 5 p. u" f+ g" o' [3 c3 }
// Enter the path to a model file! w# [" K8 Z9 D7 w/ h4 J j2 V% l
simple.LoadModel("C:\\Models\\Test.spp"); 7 I" Q. b) c+ K/ P! e
}
6 G3 M. x4 H1 B( scatch (e) ; P" p; H' t) f# |9 R, r
{ 0 }! d; ?1 j+ M! J# g
WScript.Echo("Could not load Model!");
$ n) n! M. ^ A4 a WScript.Quit();
3 i7 b8 K S* ]# A* `0 g}
3 P& b1 ^+ s: s9 K
8 c' V* ^: J6 m" u, T' v4 d9 ftry 4 e! R0 ?6 B/ R/ p
{ 6 z% N1 D$ T$ k% `. }% U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( A9 |8 F( l A; [8 ]
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* a2 B- i" {) Y5 H# i7 J+ N6 v6 W( y if (r == vbCancel)
0 c% Y( E' r6 g& C { : c6 |5 H5 I$ s) o5 @
simple.CloseModel();
3 s! u# r% v$ ^, O: W) C1 x WScript.Quit(); ' L- m9 r2 r5 z" d! C/ Q/ Q
} ( ~+ u4 w9 G4 J0 L8 D3 H
}
& L" F8 m/ O; C% o* p |- H% E; i! ~* _9 X
simple.StartSimulation(".Models.Frame.EventController");
/ s" i# S% ?- P
1 ?9 L" A ^0 D0 y0 e1 Mif (simple.IsSimulationRunning())
. L( G4 ~7 F( |) L8 W/ G WScript.Echo("Simulation is running!"); # z, v" y k1 N, G. `; k h4 r+ f+ p
# `3 W$ D; C; C4 x7 k, S, c
// Wait until simulation is finished
( a' ?1 i) I" R) N3 Uwhile (!Finished) WScript.Sleep(2000);
4 k+ b: G5 d9 M+ d! j
3 J6 ?) L' w) O# zsimple.CloseModel();
0 b, `. f# G! N9 U/ f5 y$ u& P- K0 isimple.Quit();
o4 ~% u9 c; k5 N; d0 F7 i) E# qWScript.Quit(); - Y) M& @& t7 r0 n% v# h- T
+ L! `- e/ r+ k0 i
w8 B7 I2 Q6 t: N" ]
function RemoteControl_SimulationFinished() 7 u) S: [4 n1 j
{
) `5 O; D3 m6 H Y- |( n WScript.Echo("Simulation Finished!"); |