Example of a JScript
& ?1 Q- D+ i' E. E: D# ?var vbOKCancel = 1; % T. M. q1 ~ D' [. [
var vbCancel = 2;
p8 E) I8 I; j$ ]* G* z8 z ^9 avar vbInformation = 64;
- H0 y j# f+ L- A# Xvar Finished=false;
+ q3 v. Y3 ]) G9 }
" i; p! p- ^- Evar WSHShell = new ActiveXObject("WScript.Shell");
9 p. } n; q- @* ]# T7 m+ \
{7 p8 ]9 L0 O mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 ?+ N0 @0 ^ i) w" s. N
2 x& m8 \& C/ y% M; ?# Gsimple.SetLicenseType("Runtime"); + f9 H# ]' e9 c/ A' `
3 m. O5 G' ^, T5 R% s7 H
try : `5 t) S" N/ O( ^
{ ( \6 M5 c4 n) @. Q9 g
// Enter the path to a model file! 8 @, |8 [% y _- S; U8 e
simple.LoadModel("C:\\Models\\Test.spp");
2 h) T8 R" e; l6 u8 y} % \; ~+ W* J7 S b) ]1 h7 B( k
catch (e)
! w9 S5 x1 p+ h0 ~% g{ / D J) S: F1 d/ b3 ^. v
WScript.Echo("Could not load Model!");
+ i/ c4 |$ G5 r# J( \% [) j WScript.Quit(); % `* Q3 s& i/ y4 _# h
} * [; S: u% p+ h P8 S* X
]( m6 P' I1 p2 d$ v" N
try 9 G. T* u( Z3 J8 z @
{
" t/ B2 Y0 s: A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : H# O; p. l1 w/ L/ _
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ Z; x% U8 k! G$ e8 X
if (r == vbCancel) % r4 q: r- j8 n' s4 Q6 ~
{
7 D# H4 g5 z. j3 y0 b simple.CloseModel();
% p3 Q' |$ [) q, W+ n WScript.Quit(); . y" H B% S" I2 k% K
} 3 D0 }7 s9 E; h% O3 b' ?0 }: z
}
$ i. V& ]) d& F2 v$ r " S' l1 [: b) \& [$ Z
simple.StartSimulation(".Models.Frame.EventController"); - y$ v Q1 L3 y! K2 P
6 b- y7 c0 t' V! v& ?( C3 W
if (simple.IsSimulationRunning()) 7 d& }0 ?( ~# H- z
WScript.Echo("Simulation is running!"); " r/ {4 e' F4 N" j% Z! H& S
; v3 J% F7 z) F5 V6 R. l* X/ t3 h- I// Wait until simulation is finished ' x/ B2 d5 v! _, t; L1 \
while (!Finished) WScript.Sleep(2000); + M; w9 f2 B- z. m1 ]# f
+ Q; Q& ~# K+ }4 Y+ Fsimple.CloseModel(); 7 B7 p3 |. i+ c. o( ]' r
simple.Quit();
- {8 N( ?' D! ?% \+ G \$ F) cWScript.Quit(); 8 V7 w1 K$ |2 O
7 Q( r+ s5 _ P
' a# w0 w6 R5 cfunction RemoteControl_SimulationFinished() 0 |7 Y' Z# P8 C0 I2 T
{
% [. R# h0 P' a, } WScript.Echo("Simulation Finished!"); |