Example of a JScript * v! W: M4 @! z; }0 m# E
var vbOKCancel = 1; : h( ~6 E( U1 b7 K$ Y+ _( s7 p+ u
var vbCancel = 2; 4 N- T9 C9 x# @1 M8 z g
var vbInformation = 64;
2 p' Z' a5 d; cvar Finished=false; * k, ]! j% J* f, w! c9 ]5 R- k! P3 c
5 r$ U$ O$ _+ v, v) Bvar WSHShell = new ActiveXObject("WScript.Shell"); ' g7 P7 H( |& v8 P ]5 q2 p5 g
5 [# x+ M7 Q2 b: I
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . m2 k6 c* E# g: E, D# p; a0 K/ g
# L% d) d" I x Y5 bsimple.SetLicenseType("Runtime");
- b0 v+ G9 K$ j2 R! {, G4 a+ V
2 l/ j7 X9 u' Wtry
3 F$ P' N6 V& E% B! t{ / P( L, l, |0 P: a1 ^% V
// Enter the path to a model file!
5 P0 s! F& q- Q) `+ J# G simple.LoadModel("C:\\Models\\Test.spp");
7 j5 G1 t' ?0 Y' _- C) B- N}
" Z9 Y8 S% A5 Y" q/ U/ n& icatch (e) ! W, i/ c+ n; V
{ ! {* }# ]. D" N& V; s
WScript.Echo("Could not load Model!"); ! ~+ R$ `3 q I
WScript.Quit(); 4 c* g8 F9 N' I
}
+ i% T& c% _6 ^
1 p+ t/ o3 O4 Jtry
1 o) F; R* V+ |4 Y, \/ r% \{ " f+ n5 L/ Z6 e
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + B9 @# X" {9 O& y$ M4 z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) L2 y% J& U- u& t2 j* t( g if (r == vbCancel)
9 t* [3 t# u8 _2 i& L( H: | X+ m { 4 g# M, i) Q) Y" A1 T1 |
simple.CloseModel();
, i; H( V+ ^- Y0 \, b" D WScript.Quit();
C& r! v, t7 f& e0 E4 w1 |! T8 E }
6 X, c: Z- v% S% V8 o! d9 j$ e} * ]8 {9 m! _, D9 e! N( k% X) \& v
0 y. i! x2 N. x; D/ R! q7 H o# b8 Osimple.StartSimulation(".Models.Frame.EventController");
. H0 j! I* P& h; Z4 J
% ~$ `; G$ N. M" y$ |9 Yif (simple.IsSimulationRunning()) , W% k, X% ?6 C* t9 a2 N% h* ] U5 U$ l
WScript.Echo("Simulation is running!");
. R) Q3 I" a9 _9 Y
2 N; D' U- H$ A! p// Wait until simulation is finished * n5 K9 K) [5 x, m$ g
while (!Finished) WScript.Sleep(2000); 7 K" P# a5 o% l5 I
' a: M2 m# \8 p$ e+ ?# B1 S0 Esimple.CloseModel();
3 Q0 A* l8 C8 K: G7 Y; hsimple.Quit(); 6 `" C5 |, \+ Q6 o3 N; N
WScript.Quit();
6 X) h! p+ I1 X2 q' V
. Q1 X3 Z7 M: W% U: |1 U1 ~
/ A% `7 r q, e9 |8 q7 Nfunction RemoteControl_SimulationFinished() c0 }$ n" J* S/ v, m; T$ U
{ . {& C' n* [' Z7 ]
WScript.Echo("Simulation Finished!"); |