Example of a JScript 8 ~& A# }* \5 c& ~! T) O2 k
var vbOKCancel = 1; $ G+ T$ R! j3 v9 U6 m( s* {9 [
var vbCancel = 2;
- \. O! O& m+ D, y. s, w9 G+ yvar vbInformation = 64;
% S. c2 ^# f7 M& u' k2 m& Gvar Finished=false;
: t! W0 l4 G0 h) K. w2 E# L f$ E. X4 m1 O2 X+ E8 M/ M
var WSHShell = new ActiveXObject("WScript.Shell"); : j, U% E% A: u4 B( v! D0 r8 Q
3 a' ?0 h: n* Bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * w) u ~6 r- M7 F
1 e: } C* ~1 f/ |5 y# U
simple.SetLicenseType("Runtime"); 0 y4 t; P) X) d2 w
& Z6 o% ~6 \5 {- d# ttry
( S4 N M- h( f* b{ ! h8 P1 w- I; k5 d; Y" [" U
// Enter the path to a model file!
* n0 `$ _: Z% M' _& S; x4 f simple.LoadModel("C:\\Models\\Test.spp"); 0 }# ^) W G8 y( g
} 8 N7 {( i' J& R/ e" @1 K4 _
catch (e)
* X4 s8 ~: I5 G; N/ c, d{ $ \, `, C, W8 ?2 I; z8 M1 B
WScript.Echo("Could not load Model!");
% n4 {' i3 q, o# Y; Y WScript.Quit();
% x% o8 {0 x5 t6 m) J1 A* x8 R}
7 ]1 v9 u- C* c# E2 C4 k
! [0 v& V5 O9 ]2 X$ \2 i8 Ctry ( D! K" L. {$ {% I
{ ' N/ `+ \. [2 p" n3 N: Q0 Z/ {; z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' x8 n. h" B$ W+ A+ Z% \; i* G6 E3 ]) M r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , K; m$ n4 S, l3 Y9 S4 f
if (r == vbCancel) 3 \. J) c, z/ o8 ~2 z1 r+ U
{
) A, s( t; w; X* r6 a& Z) r simple.CloseModel();
( r: R5 B- i! Q WScript.Quit(); : G# l7 C' S7 O9 |+ d
} " c4 g" J# ]+ [' N
} ' T% t; D( J2 {; U; W
2 [6 |2 m) u& T* K$ {7 msimple.StartSimulation(".Models.Frame.EventController"); . ], G/ S& `2 B' Q# Y
- M( m" h5 w% p* q- n7 Gif (simple.IsSimulationRunning())
/ T8 Z, a. Z* X5 W WScript.Echo("Simulation is running!"); ) u, z8 W' x$ H& D4 H: O' k
: f8 \- [$ \# R, U
// Wait until simulation is finished $ N, Y5 G( Y4 Q3 x
while (!Finished) WScript.Sleep(2000); + l6 B( O$ e4 e: f; @
) G) A' l& y! i# b' P1 Usimple.CloseModel();
. |- e) L2 o& v G# b h; Y+ ~. xsimple.Quit(); 6 N$ f8 z2 F' `3 ^8 N+ w6 t
WScript.Quit();
& K1 r: `1 L$ P- q* a, t) W( ^ ( ]5 M, _9 J5 ^% s- J! e$ a$ @
" h9 |' d3 R( p, E1 E8 v/ s
function RemoteControl_SimulationFinished() 8 b9 {9 W0 l: S5 Y# Y8 M2 P ~
{ # U. E. |9 q1 J' m3 v( Q$ K
WScript.Echo("Simulation Finished!"); |