Example of a JScript
- } R: ?/ G8 i# ~+ n e& b- rvar vbOKCancel = 1; 1 i. f1 P8 S% d! w; S! V
var vbCancel = 2; $ p, U# p/ K" x, l8 C
var vbInformation = 64; % N' q |5 n$ E8 ~( j& ^
var Finished=false;
0 O+ R1 f* n) y% l) B/ Q : j, p% ^( g& \1 ^+ }' B) {
var WSHShell = new ActiveXObject("WScript.Shell"); & C1 @7 P" w. F( q4 Y8 n
' X2 j7 M. F# H6 R1 svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - t$ {, A$ E- e8 d- w
! O4 h1 t1 S7 p' N0 ]$ k+ vsimple.SetLicenseType("Runtime");
& T& l9 o; k2 R) _0 ?5 ?" V
! e4 l8 H( e# _1 w( W! {, j. z. jtry , H9 Q, ?2 M" I: `! @7 N6 a) v
{ ' Q7 `8 ]8 b5 b
// Enter the path to a model file!
& Y, Q9 `0 ~( ^ simple.LoadModel("C:\\Models\\Test.spp");
/ s( o6 x; _2 R2 y1 r; k+ J: `} 1 @; {% x% D5 E8 i$ w& V R$ ^
catch (e)
( o, r4 |- P) r N8 c{
' f2 `3 j8 B' j4 w) d1 D( I WScript.Echo("Could not load Model!");
% B, Z+ Q4 L$ @0 C WScript.Quit(); % n6 d u1 n X: q1 p
} ' N9 K; M' R* h; P
# I0 U3 \! h0 o) B+ ^try + F' [+ b" b7 G
{ # r$ F/ T; T2 B6 b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# y1 O7 E" o$ z5 F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: k2 d( X8 }2 F if (r == vbCancel)
& s3 f* V7 W/ |( l* P {
# O& ?. ^0 X( D3 V# |1 s, R' R simple.CloseModel();
# A+ K" j8 E& k. w: X WScript.Quit(); % t1 W7 p. B( b
}
/ D+ O' u! D- m+ K/ I} 2 {. G. I: v7 {
$ M. Q5 W: H, F" z+ nsimple.StartSimulation(".Models.Frame.EventController"); 7 o* H& F' w, v5 e7 q
1 N2 r1 w* X; F0 l4 O- S
if (simple.IsSimulationRunning())
# F: k+ G0 J: D& t4 v WScript.Echo("Simulation is running!"); + a4 B1 a% `6 A" `9 C$ u: `; \! D
- l& x! p$ `2 x6 a! s2 t$ s
// Wait until simulation is finished
4 l h2 \9 a* J t! d1 iwhile (!Finished) WScript.Sleep(2000); s4 |0 S* x0 `2 @4 Q
) s+ }: P( A8 qsimple.CloseModel();
# s& W; p s( z7 Y! H/ |simple.Quit();
8 o/ U2 ?# c, w- _/ RWScript.Quit(); : Q. F+ p3 w4 V, H. W. i1 t3 h: p5 d; R
. m) S& ? R+ k9 {' l! P
% f" W0 J M! m& \function RemoteControl_SimulationFinished()
/ G# P; |6 l7 \{
8 z9 d0 h6 e2 C$ N) _7 U( O* Y WScript.Echo("Simulation Finished!"); |