Example of a JScript
9 H3 P) B3 z8 ]( M+ ovar vbOKCancel = 1;
# @ g# P( G6 e, Y% d5 V% t: Qvar vbCancel = 2;
8 ~% X* Q7 ?+ ?( Z: Uvar vbInformation = 64;
9 a' t0 }( w8 q9 k( ~; t3 _1 evar Finished=false;
3 A6 o( `/ s7 I0 v5 a9 ]
: q4 B4 b' o$ gvar WSHShell = new ActiveXObject("WScript.Shell");
, S2 w4 u8 @& T/ I9 T ' I2 C, B9 L" I- I$ i7 A- [% N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ D# Z! R' \: {' n5 d
) [& p/ O, P, L( H: e3 |
simple.SetLicenseType("Runtime"); ) K8 Z6 y; `2 a5 Y
4 v( T% E& }- `3 `
try 3 r5 e$ |/ S( w i1 p0 B9 e
{ ; V7 D3 r3 ]) J
// Enter the path to a model file! 9 N3 o7 Q1 I9 K+ [2 U$ {- L
simple.LoadModel("C:\\Models\\Test.spp"); % U! U1 j5 k7 [/ o+ f1 c
} * G* X. M* U" J, ^& y2 y
catch (e)
# G' }/ f/ M5 s E{ 2 r& {+ ?; P; L' l- a4 x
WScript.Echo("Could not load Model!");
# l6 o$ o6 ]. j WScript.Quit(); 3 Y! O+ e8 b9 L; q- T! D8 U
} 7 Z3 H4 Z x y( B5 S0 R
7 [* _1 p ?* C7 E- Atry 6 @6 n" Y; h. {, L0 O" ~
{ ( p/ J/ |+ E& B$ y6 s" m! m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
X1 K% Z0 k+ D1 |2 e ]1 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' j; @' `" ?, b# y4 ]- I: u3 }( g" Y: L if (r == vbCancel)
! f* N7 U0 k: W* Q/ {. e; g {
3 ]! j U" U( f9 ~9 j# L' E simple.CloseModel(); * _3 H; c+ @- v: h
WScript.Quit();
6 u) O7 x- c2 s6 c8 n. n } 8 P' e; U }3 B2 m! q
}
7 O* |! B" t0 c# F
. h( A& q; p% tsimple.StartSimulation(".Models.Frame.EventController");
0 p4 \$ V' i q4 b- M8 l5 R ( Y6 }8 c8 E0 {' ~
if (simple.IsSimulationRunning())
: s& W: k$ g; S, ?* z5 F WScript.Echo("Simulation is running!"); ( H* g( O( O) U% W
3 d1 z4 n/ y. D' v' R% Z// Wait until simulation is finished ; j$ f+ C2 J3 R% y8 u
while (!Finished) WScript.Sleep(2000);
8 e8 ]' R+ Z' s" H
4 y9 z& j2 R& q6 X5 m b! ^simple.CloseModel(); 2 x! s% x/ X- K6 W" v
simple.Quit(); + \6 l4 g- G x0 i% T
WScript.Quit();
6 [% M6 |8 _7 {, X7 S( I- w
$ @3 z a+ P( O2 }9 n8 T# N7 w+ r
) q4 P1 `+ {3 W) |7 qfunction RemoteControl_SimulationFinished() ) E* F5 O; j3 {3 V- {4 o, ?
{ 2 L; @, _! {( r7 C4 M) j" l) O
WScript.Echo("Simulation Finished!"); |