Example of a JScript
' z9 t8 A8 X1 V2 ^2 J; M6 P7 L hvar vbOKCancel = 1;
) k9 f6 p. `7 E" b0 |var vbCancel = 2; - M; Z0 A s$ t5 s# s' H4 P
var vbInformation = 64;
; m8 o% G' Z- b$ tvar Finished=false;
4 Y2 T4 Y( y. k/ U
Z) W, B- P, |+ \, X1 h0 `, dvar WSHShell = new ActiveXObject("WScript.Shell"); d4 j+ O' ^+ }1 l- F" X
* Y% P+ g' V8 X9 ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " @5 y4 k9 x0 q* g/ a" I
" O& b; b3 s8 {- O9 `. t5 q vsimple.SetLicenseType("Runtime");
1 C% Y D( T% A% w- n( w 4 B) M9 \0 ~* V/ p- n1 V
try
. }# M0 s# F8 M- W{ ) a0 F N) \& X
// Enter the path to a model file! ' _) F! B* O. }' Q4 [+ w
simple.LoadModel("C:\\Models\\Test.spp");
2 Q- d" G$ ~& u( t/ H) I! C}
1 v5 Q4 V, r6 G+ u* r/ Jcatch (e) 6 O) _" }9 V {1 u) y+ K
{ l" b" G h- B4 F; Z8 Q
WScript.Echo("Could not load Model!");
. }* J$ c) {& T+ A WScript.Quit(); : m/ b( a' n1 g9 N: J
}
# o$ N( l- R4 @2 q6 u9 s . t1 `5 K2 Z! D D, S8 _: M
try % r3 i; S+ ]" V* C0 ]
{
; O4 V2 q1 [7 w. E0 Z! o7 U! z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 a+ ^1 D9 M) L% c) k1 v: { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / G* Z, C5 a0 z$ b1 d4 I( v, I# b6 L/ z
if (r == vbCancel)
1 i, H L( h0 M1 z6 V7 P {
9 i" ?0 a0 q& O, ~ simple.CloseModel();
. c. w: ` G! c" A3 D, B0 `5 o WScript.Quit(); ( m6 s8 E' A. s6 [
} 5 [6 D: |7 F) v8 n5 y6 r7 k( a
}
. y4 n; [8 g8 ^+ T3 h6 S' u" a 0 S" e& ^) z# ^
simple.StartSimulation(".Models.Frame.EventController");
; e: m+ O& N; U/ y4 {; k 2 j3 v. G" V, [3 v4 R3 l' Y! n
if (simple.IsSimulationRunning())
$ \9 c. Z6 y' i4 d5 W5 K0 H; l WScript.Echo("Simulation is running!");
/ D5 T6 H8 j$ ?- B _
, s6 M9 q+ H, F0 E. e// Wait until simulation is finished
+ e% t6 d9 g. S$ Twhile (!Finished) WScript.Sleep(2000);
! f% c3 q1 p# a( g/ l4 G$ W : a5 y6 m8 ?$ P( @5 n! m" S
simple.CloseModel();
2 G) _$ {+ n+ l; z/ M0 x3 M" Asimple.Quit();
' h! | W2 s8 m8 `9 s% I& J( sWScript.Quit();
5 i( A2 J5 [ H
1 w9 |2 L5 M0 h2 D 7 I6 k9 W$ k, ] I: g- u
function RemoteControl_SimulationFinished()
7 I" t2 R9 C6 k' P$ R{
5 }2 M4 a2 n) b( n4 F7 H- e7 P( ~ WScript.Echo("Simulation Finished!"); |