Example of a JScript
! G, d. s7 W( Y1 h( evar vbOKCancel = 1; - t& c" \1 n: O0 s% n% t
var vbCancel = 2;
) L% F% Q- B7 d+ Z- rvar vbInformation = 64; $ ^/ ?: y4 G- U3 Q
var Finished=false;
- \! t. G/ U, z; H" |. F( d. x
- Q5 f) p* P B1 z4 evar WSHShell = new ActiveXObject("WScript.Shell");
0 y9 n% }; ^2 b* J# E! P& \! L9 i
$ I' d" F% K+ pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 |0 R" @% b7 x( s" f v
# D% t5 g7 b. u5 n
simple.SetLicenseType("Runtime"); / o y" v$ x0 u n7 Y% L# c, Z
2 B/ q7 l+ g8 W3 \9 L
try 3 K. c3 p# m1 {7 }+ Q
{ 9 q# i n: Q4 k! ~
// Enter the path to a model file!
$ L: U2 [% e$ z) t! ]; J- x simple.LoadModel("C:\\Models\\Test.spp");
7 v0 Y% P0 F8 o5 w} * g5 ?- e, L( |+ S3 j3 U; p
catch (e) # ?5 M N* T% i& }' [' e# i( M
{ " d! j9 x5 ?8 F
WScript.Echo("Could not load Model!"); $ w3 s" ?( H) X5 ~& {, _' e2 j9 }6 S* Z
WScript.Quit();
1 S; F) a T/ }, Q- y} - W5 y; x9 K' g- C
% y; K4 e- p0 p" B% H/ Z
try
, ]/ C$ X% c1 P O, _7 C/ ^! R{ % y* g& q8 l5 u, N4 t& t- M' }. ^7 O4 A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' \+ z% _3 q& y% t; B5 w& Z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' }, v' S/ w( _6 E
if (r == vbCancel) + E2 N) _! P* X8 A" {1 y
{ / \7 O) A. T* c" A2 L/ W0 N
simple.CloseModel();
4 j* J* t1 @/ d. M WScript.Quit();
8 C$ g* Y6 s& d" U+ S, W }
% C/ ~9 t3 j; I. f}
' G5 q5 }, ?5 n1 \( T7 | % P& z8 c- x1 a F/ \- ~$ T1 A
simple.StartSimulation(".Models.Frame.EventController"); : ^0 q1 a& i& w5 S3 w' J
7 x3 Y1 ], w0 `) r5 R$ d
if (simple.IsSimulationRunning())
/ x: C0 ]" N; Z( t7 Q2 }2 m WScript.Echo("Simulation is running!");
5 \* S3 H' l7 Z6 X) O6 ^; l W% U' `3 E ^" p
// Wait until simulation is finished " |6 L7 R* W3 `9 I5 n' d
while (!Finished) WScript.Sleep(2000); $ K. o1 p! Y- l+ i
0 m8 _+ T+ t4 e3 B% f ]3 G
simple.CloseModel();
) ~& A$ X$ L) g u$ c5 b( ksimple.Quit(); + L) C" X, M- g! q8 W
WScript.Quit(); 6 V; {" O6 J7 ?4 |! W* R% Z
$ l$ G+ S3 K0 \* S7 v4 O8 V& ?
& j. ~# `2 `& r4 _2 rfunction RemoteControl_SimulationFinished()
/ ]1 l0 Q8 y S1 |0 e J3 O{
, ?8 G( S6 q9 Z, i2 f# ]4 B$ M4 j WScript.Echo("Simulation Finished!"); |