Example of a JScript - V$ Z7 z! @0 Y% Q( L
var vbOKCancel = 1; / `% ?) n9 E' l+ |: z5 t
var vbCancel = 2;
+ P7 e0 F8 L# ?4 J# ?- evar vbInformation = 64; , R5 |, c: e% T: O G4 t8 g/ l
var Finished=false; , ^, t, B: ?: F7 l* H) q3 `% U
3 z0 {4 A" [) |" @
var WSHShell = new ActiveXObject("WScript.Shell"); % E8 l% U( G4 d8 Y8 @' K# I
! e1 f0 }# b% U: P# n8 {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* u% D; j5 O1 p' b- @( S+ M ! V% T" l4 Q" D; c+ _+ |8 }, _
simple.SetLicenseType("Runtime"); . F: E9 ]$ \4 r0 c
; b& e2 o& |0 z6 W* }try
8 ~/ Q: @' v# j/ [{
, K/ u# Q0 a# r" t; q // Enter the path to a model file! 9 h! R8 a5 i& [5 Y
simple.LoadModel("C:\\Models\\Test.spp"); % t5 J7 B W6 v! I& r3 x& r
} # D A$ @# o1 R g0 [+ f0 o
catch (e)
" k) o. ?2 |$ z" A- `{ + V- `0 ]" A$ Z9 B) I
WScript.Echo("Could not load Model!"); . e. j% Q- ]/ I6 ~( O/ j* }
WScript.Quit(); + y$ G$ _5 `; l2 X. o
}
% r- i- Z9 t" w; s* k
0 T7 b0 i0 b) d$ `try & h3 G/ {0 l! E
{ & X, ?, @: ^# E( }0 R/ q& y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! v- v# X7 \: N$ \5 c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); [+ o) j6 [4 x, X. k E( ^" V
if (r == vbCancel) # Q8 T0 a% a3 b* k# v& ]+ ^
{ ( M3 G e- \- B$ @
simple.CloseModel(); , F( n: v* N6 a% ~
WScript.Quit(); + V: M V2 x6 i% L$ i1 F4 \
}
" W8 s( b& g8 G, W/ v! P} 8 d. f" T7 s) {# m f2 u
: H$ [7 A( v L: L usimple.StartSimulation(".Models.Frame.EventController");
3 ~& f( R( G% C( B/ }* P
0 t* i. b, \2 K# k$ iif (simple.IsSimulationRunning())
+ o6 D8 _1 i2 t5 ]9 ?: r WScript.Echo("Simulation is running!"); * _' x2 {( j4 W3 q& a) \7 ^
v. a7 p, P# y// Wait until simulation is finished
9 l4 k2 R, j6 ~; X9 v4 R. Swhile (!Finished) WScript.Sleep(2000);
7 U$ s: k/ _$ e7 K : ^& o. d3 H, y9 c" y
simple.CloseModel();
* k0 ~, _" S" nsimple.Quit();
~& N; R; j% A: U0 K. I* YWScript.Quit(); 6 E4 m, D7 i; I% Q- F$ k+ e
, _+ T* P8 H& C
- g$ _- I. Y1 ~ I% Qfunction RemoteControl_SimulationFinished()
7 `8 ~: y3 v4 P% I0 d{ ) M9 A( Y- x( a" c
WScript.Echo("Simulation Finished!"); |