Example of a JScript * i& O2 D: X6 R$ d: I" j& g
var vbOKCancel = 1;
# d$ F4 g) B! ]. k/ \1 gvar vbCancel = 2; * D" M7 h4 C# t& T$ d! _
var vbInformation = 64;
6 ]& I# B1 a' bvar Finished=false; , x# E* _% e: J/ J# I, t$ T1 R
5 k' Y; q/ H! M# ]
var WSHShell = new ActiveXObject("WScript.Shell");
- B5 K2 ], k' {4 h3 B1 P! N
0 Y- ~$ {- i; |0 ?var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: E; V( _, _) m/ q6 \6 s/ d
' Y3 r) W& L; b! P' T" vsimple.SetLicenseType("Runtime");
: u' U Q, T( a) D# ~5 M
7 A- W& a; E/ E( n* l# L6 z0 y1 @+ i' Btry
# E$ k; ~3 Y+ T$ s F5 d2 [{ " t9 h" K! Q7 L! z4 g. U1 i: H, z
// Enter the path to a model file! " x8 x/ ?/ N% @& Q( K
simple.LoadModel("C:\\Models\\Test.spp");
2 i' t4 b! r: p; S" v}
. P0 h0 a) s# `) dcatch (e) 2 \& G* f* r) Z+ m# L% N% D- }
{ 7 M/ X* T3 D8 s q
WScript.Echo("Could not load Model!"); ; f3 G9 ^- H# G8 o. c9 W. m
WScript.Quit();
+ K5 p9 `: Y; x0 x2 c# H! A} ; k' c! _0 g3 M
+ W6 E. T( E' s; `# w
try
. ~ S8 \3 |' C; T% D( j8 _1 C" e{ ( P( ]- N% ?- p& c) A% \% f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; v* s/ c' n4 O. m
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * ^/ }5 g3 e7 x9 i9 ]1 T
if (r == vbCancel) 7 k& c3 F: K: B; R6 Y8 B! _7 t
{ 7 X: h5 c* t- z
simple.CloseModel();
$ m% I) {3 ] n8 u- q2 E0 a* K. J2 L+ D3 G WScript.Quit();
6 G4 W" D0 Y/ v6 J# c8 b* x8 ? } - [. [1 y$ t# i' p
} 7 H1 y+ u& {7 e
; s# U* b0 C5 g- d5 \% A& A: L& s
simple.StartSimulation(".Models.Frame.EventController"); : D f8 x: }( k1 V
# s1 j5 H9 w! s- G% c
if (simple.IsSimulationRunning())
e1 c f. \6 W' W4 u% n: x6 q1 s, Z WScript.Echo("Simulation is running!"); 9 a1 f3 M* U) r" ?! Z3 i' M
0 k* ?7 N; v; ~( ]% A6 l// Wait until simulation is finished
2 \8 h' f% a8 w& wwhile (!Finished) WScript.Sleep(2000);
, p* a; \/ I4 f6 n, b
* s [5 l% D. P7 c2 K4 T+ U: Ssimple.CloseModel();
! ^6 z6 C) b' B0 L* G s: Q9 psimple.Quit();
! Q2 j. r/ Q7 lWScript.Quit(); % c9 E0 p* X* h% E
/ w8 j: W. p( t7 G" I/ Q8 | % O- a5 N. Y+ N$ s& C
function RemoteControl_SimulationFinished()
J# S5 Q7 Z# E. |{ * X3 R! l9 i) h+ V6 X7 o6 d( y3 |* q
WScript.Echo("Simulation Finished!"); |