Example of a JScript & |/ \# o, ?. v- Q5 A9 @: F8 I
var vbOKCancel = 1; : i/ H3 m Q# S# Q/ J7 T
var vbCancel = 2;
) E3 K$ w9 P0 z; F' uvar vbInformation = 64;
$ Z j" _/ y7 t8 B# m, kvar Finished=false;
/ D$ s& O3 n7 f7 M9 n 7 Q) Y# N. V% R
var WSHShell = new ActiveXObject("WScript.Shell");
. Q2 h8 |. p) Z" R
+ H+ M" r+ M7 |& s% {1 p, f! evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 w: m' z8 `; V8 S
! {+ U( j4 W- M! e$ M) k7 N, F1 Csimple.SetLicenseType("Runtime");
6 i7 K/ O) K9 Y2 E ) t8 G" t, |& @* c, F6 F
try : p; E. I8 V* i
{ . o6 g6 |, |% l9 U$ l, d9 e7 }
// Enter the path to a model file! ) U5 `3 H+ {' I3 F6 a# b: i
simple.LoadModel("C:\\Models\\Test.spp");
+ z4 i. W0 o2 [6 ]/ o- M' ]} 9 ~, Z: K1 e/ t! o6 k
catch (e)
/ k9 y' s; i4 T5 \{
+ p0 J# p8 {2 h2 ` WScript.Echo("Could not load Model!"); 4 ?% N; _( K5 @7 |% J
WScript.Quit(); 0 x' b7 w1 M4 F& Z4 d# C- C
} # b1 d% C5 C$ @# \% E; \
2 @. B9 l/ m) C
try
5 @/ [# T# v5 s: R% ~: g# q{
: g) h* f* `8 k5 W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 [1 a+ c0 x c) e, ]) ?% X! g% ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " D7 c+ N, b/ Y" i2 ^. W
if (r == vbCancel)
: y7 s' e% T2 M% e { : O( F5 i9 W1 z8 `/ s+ y, B
simple.CloseModel();
3 A5 s0 l; M% t' Q' o5 ? WScript.Quit(); , a6 b+ s8 [$ W0 K+ t
}
/ c v( O6 m) M/ d4 [} : C; E) ~! o6 Q6 {" a: |
( L( I7 {* p! N' W$ x; V9 h+ asimple.StartSimulation(".Models.Frame.EventController"); , r" ^0 e3 c% \9 J" G8 \1 `
* r) i2 T3 G, T7 |) N
if (simple.IsSimulationRunning()) 6 C; P5 }* @) K# V2 Y9 I K
WScript.Echo("Simulation is running!");
& R5 Q1 R$ h, r. e3 C + |! s' u/ v6 e% Y' h/ Q, w
// Wait until simulation is finished : W8 A$ G9 E; x2 D& y
while (!Finished) WScript.Sleep(2000); / Y- _; a' O) T4 }/ e- U) u! k( s4 Q
. h8 f9 l9 i$ h% d$ B0 J! L- D
simple.CloseModel();
) B5 u, ?) k+ wsimple.Quit();
7 O5 r- v, a. ?! e( G" `! zWScript.Quit(); . f3 _. V5 B' f" O, }
" N0 e( f+ y9 i9 q
+ N4 |# V" n% O* \) d2 N& b9 Gfunction RemoteControl_SimulationFinished() " G& q+ F: J$ ~: n. I/ x/ Y0 C
{ ) R( X' H9 M4 W. x, F
WScript.Echo("Simulation Finished!"); |