Example of a JScript ; k, W6 [; B6 O/ S
var vbOKCancel = 1;
) W) l, `2 C8 Q6 wvar vbCancel = 2; ; A. A6 r" u! Z0 M4 X- ?! L
var vbInformation = 64; 6 g- M7 P2 v" ?3 m
var Finished=false; + T0 U4 S/ I3 {
2 E0 Y2 o8 X! ]2 E, c* h0 t
var WSHShell = new ActiveXObject("WScript.Shell"); # c0 [# _: e6 }8 G) q$ h* Z6 @9 F
" A, k9 N* Z7 V3 k4 E- \var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); M Y+ ?$ u9 V& `
( ^8 `2 f4 a; D2 I$ L! u! H0 a1 {
simple.SetLicenseType("Runtime"); + R. W2 V- K" @" L5 ^
* i/ K7 u% t, P/ I. ktry ) G; s+ F. Z4 {; N4 L/ z r
{ 0 g- c% E3 Y+ z& E1 g- ]
// Enter the path to a model file! / w, g; P5 B) r' W, Q; g
simple.LoadModel("C:\\Models\\Test.spp");
) `9 V) E" ?) g' q( V} 1 }+ {/ _! I+ ]
catch (e)
5 Y- q% Y8 Z8 |1 ^2 w+ `3 N3 T+ J{ 7 L. y8 ?4 x& X* ^+ O) l
WScript.Echo("Could not load Model!"); ; `- B% J- ~* f4 }( k1 a4 d* d
WScript.Quit();
5 s& r. D% Z$ v Q1 a2 e}
% o4 |- X' l* ?# a$ B3 ]/ T& s
2 [& G4 Y) P( B( m# btry $ t. z, R9 X3 Y
{ 8 }$ h$ |7 [6 d: m4 R5 Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " H7 w, _( @5 S4 Y- O
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. Q7 o. a: t$ ]7 P# X0 v- O if (r == vbCancel) 9 k8 [; O Q7 D9 o
{ / Q8 W: D) _; W! Z/ T1 A. e$ o
simple.CloseModel();
( t; y( \$ J. o WScript.Quit();
5 y |, G, E& @) L% b \ }
, f ]0 {9 C0 L6 p7 O/ V} 3 H$ |) C$ q4 p4 Z5 [5 s$ o$ a0 s
9 ~& ^ n0 i2 | P+ q5 H0 R6 Csimple.StartSimulation(".Models.Frame.EventController"); 0 E6 J8 \. N4 l/ b/ ?; L+ S$ U6 w
+ `! }3 j; M% V4 Q5 V9 I7 U
if (simple.IsSimulationRunning()) 7 g: g( r! C$ ?
WScript.Echo("Simulation is running!");
@) ^2 R7 m) d5 }+ \
8 V; r+ L! B; g2 G7 U// Wait until simulation is finished / F& c& }- M+ O
while (!Finished) WScript.Sleep(2000); $ N: w) L2 n0 n: D u) R4 T- d4 x
/ w7 Q; P5 [+ u4 r0 i1 ^: f a0 Esimple.CloseModel();
& k6 ~0 _1 b7 msimple.Quit(); & y+ |& w6 k8 z: @" A6 E2 s
WScript.Quit(); - \& u m- c% L3 l$ n$ c
/ K$ @! D( A4 D 8 A8 W0 d3 u5 x& Y+ Z. L) ?9 [9 t
function RemoteControl_SimulationFinished() # l1 V, j& V/ C- t- [# I& J4 d& t( n R
{
/ `1 U' z/ b9 E' r WScript.Echo("Simulation Finished!"); |