Example of a JScript 5 S+ }" d1 Q4 b# w' x
var vbOKCancel = 1; : o- z$ ^7 f( S5 V) w/ H: O: m6 F3 n
var vbCancel = 2;
8 z; X7 | A; E% Z& \var vbInformation = 64; 2 m9 U* F p0 \: K; Z4 c
var Finished=false;
* x( T: W$ s2 }0 U " P n1 j5 y3 z- b4 e
var WSHShell = new ActiveXObject("WScript.Shell");
7 Z' u) a! {# d. {- l
" Q" ?( l( r# l+ c1 y0 a* {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: U, L; U0 @- d" s' z' i- M
4 `7 \0 b4 x. H+ c: G+ x8 \* Tsimple.SetLicenseType("Runtime"); 8 K% B+ N4 E) j9 ~
) @/ ]" a2 u7 D: [ `
try
: {- c! j! |' m8 Y3 O{
7 F0 h+ R5 W* e9 N S // Enter the path to a model file! & h k/ r$ ^) h! s3 j
simple.LoadModel("C:\\Models\\Test.spp");
4 `$ s; x) k8 i$ X! i}
# t9 }- @$ @0 ]; P* T' j9 o1 Xcatch (e)
: u+ B' U, P1 Q& a{ 3 N9 A) O% j: V8 u3 E9 d- \: ?4 J
WScript.Echo("Could not load Model!"); ' s. [# G0 O7 ], J# i5 |) a
WScript.Quit(); # n- L2 i6 ^6 S0 H( T4 ?0 u
}
0 Y# @ I; Q! S . Q3 H$ {. M5 @2 U8 `1 }4 J
try
- g0 I) n' k* }; f{ - k" e9 r) V3 m: Y! ^5 D4 P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 L; U! ~. [1 d: h. |' b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: g& b% A8 o% C4 g& K5 |$ _" I3 v if (r == vbCancel) - s; d) u4 o' W; n: [/ U D
{
# }% k! ^) [; O( ]2 F; A4 k/ x, f simple.CloseModel(); 9 u8 v5 k& g/ @* M5 f0 I# ^% g
WScript.Quit(); 4 j" a E6 L2 p @& g
}
! a- ?; n3 h B( Q% m1 q1 b}
; X% V1 ~- k4 _# m8 k ; O& L# p# z9 s! ~- ]
simple.StartSimulation(".Models.Frame.EventController");
. q* Z- G `- H/ n4 T ! y% J/ a; l' P( Q
if (simple.IsSimulationRunning())
v3 U6 D* J+ V R4 U WScript.Echo("Simulation is running!");
) u& {4 b, [- [/ ]& _
) ?) ^* F# e: d0 z// Wait until simulation is finished
2 d2 k; a# g( M1 l% U7 |while (!Finished) WScript.Sleep(2000);
' j) h+ {, X/ d7 {
& q2 c" A; {: d# W/ dsimple.CloseModel(); # o" g. U1 R' X/ ~1 n' d. M2 t
simple.Quit(); + t9 D) M' _3 Q! t$ U1 _- z
WScript.Quit(); 6 K: S, Q. T1 u4 V
6 T% Y2 ~- {* @+ ]1 A2 r" x9 p) Q
9 z; j. d) }) V9 _" jfunction RemoteControl_SimulationFinished() + |' T. n* N6 }! p9 w
{ ; ]* H1 y- }6 j
WScript.Echo("Simulation Finished!"); |