Example of a JScript 9 @5 i% f& f( D% c
var vbOKCancel = 1; 5 t, q7 B' O3 \; Q. ^
var vbCancel = 2; ' ?: t* I7 E- }1 B4 r$ E5 g+ d% W
var vbInformation = 64; 6 p! D; Z% w8 O0 O9 ?6 Q
var Finished=false;
5 O+ q( M1 I9 q# r 0 t; {9 R( R& W+ e
var WSHShell = new ActiveXObject("WScript.Shell"); * i/ d# z0 f1 b: [2 w: A7 ^, m' \
A' A1 }/ x( c( Y. [+ O# x6 Z4 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' i0 |7 b8 b4 y. R
" x8 H% A( J( M I. _+ asimple.SetLicenseType("Runtime");
$ Y7 X6 ~* I* K5 k# S6 E
0 O2 I z$ j4 ~. b8 i: s* itry
# Z0 E) l' m) }* T: t{
* s6 e# @* y8 L; q% `' e // Enter the path to a model file! 0 g6 C) m' Z7 T; M# A) z! T
simple.LoadModel("C:\\Models\\Test.spp"); . r, d3 A9 N2 B. w* B7 ~
}
% z% |$ Y% t9 N b2 lcatch (e) $ X$ e; \' ?8 C& U
{ - T6 r% l7 q" z8 ^4 W& z$ Y$ Y
WScript.Echo("Could not load Model!");
3 }& |7 O: A) W {0 y$ K! a WScript.Quit();
& B6 A+ a+ w5 o- Y& P" `2 K* o H# _}
) h$ r: K& d# a q 7 L# e9 U6 h" i1 `' R3 x
try
/ h( F, G# n% Y; [4 A{ 4 P8 E$ c: T( D3 d3 z, J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , N2 u. X! y& R6 w' u, z; a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
# M1 }* V2 r2 I) F3 { if (r == vbCancel) 5 M" u# U: I3 i! t @
{ 3 y) i! n8 d3 Z, j" Z
simple.CloseModel(); 9 e0 b$ F9 L R+ B3 R! o2 C
WScript.Quit(); ( ?. |: ?+ t( ] b4 {' k
}
- B7 {! z4 Z8 E- I} 2 B# U* K+ C5 C Q* B# ]
/ F# D# h5 M2 Bsimple.StartSimulation(".Models.Frame.EventController"); 5 |" e0 a; l+ n% c" x# ?
0 K; x* _* a- h( z7 S
if (simple.IsSimulationRunning()) ! K) ^/ |0 A7 z
WScript.Echo("Simulation is running!"); * e5 J2 W) u b7 I9 j
0 z/ ~; |4 f' r0 ^4 Y* K( D' A
// Wait until simulation is finished
9 K3 W/ X" [- S, S5 ?6 Z8 Mwhile (!Finished) WScript.Sleep(2000); # h( ?% k* c' I
) {2 S, s. e0 y! O% i
simple.CloseModel();
6 g# p% n) X, k% \; U0 Vsimple.Quit(); - I+ z9 t# U* U
WScript.Quit();
' ^9 Z8 E' ]& M9 c' t 0 k6 Y! M# a6 K7 H! d
3 i! |' t) X0 Y& C& x& hfunction RemoteControl_SimulationFinished() # h& d) k. c. v5 u
{ 9 @( D# t. B8 y/ i% j* _9 q
WScript.Echo("Simulation Finished!"); |