Example of a JScript
3 A6 x% M2 Q9 E+ j vvar vbOKCancel = 1;
7 J5 p. ^% h% u. Fvar vbCancel = 2;
6 Y& `: w0 b/ }, N# ]! r3 Mvar vbInformation = 64;
: }+ T" X! d/ |- |) N7 r4 Nvar Finished=false; 9 A0 u1 J, p. e# [ \1 k. l
6 Q- O3 j7 J% x' ]8 {8 W4 n8 `1 svar WSHShell = new ActiveXObject("WScript.Shell"); 5 _1 Q$ }% T4 p) t' `
/ N3 R. [4 y& uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- g* W" I' o, q) w- ]+ s1 x9 s " K9 [; \+ v/ Y. p* J, x' k
simple.SetLicenseType("Runtime"); 3 i* A* f9 f/ ^
9 B- C7 V8 l7 q. r$ @2 Stry : P/ U+ \( H$ _: w& D& h& O5 Q
{ ' u- u1 I4 _" R. d# s3 M' L! ~
// Enter the path to a model file!
& t! q4 g+ Q; w6 W simple.LoadModel("C:\\Models\\Test.spp"); z& P, \8 n% { C
} # g* P h+ U& b0 B& ]
catch (e)
, B0 D( ]( K& p; [{
- x6 o1 r, ?( P WScript.Echo("Could not load Model!");
: G0 X( X& A( w* |7 I4 L7 @ WScript.Quit();
0 H: k9 i! [* G! y' S} 2 w- M7 E2 R& v& k
) @% a, P3 ^+ ]0 gtry + B- D w7 U" k, {% Z$ k4 I
{ e) _4 i5 J6 A1 E0 \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
o' h2 e+ [" w% ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
I+ A! Q. Q( s& W7 v if (r == vbCancel) & p" `* Z( A/ Y! w
{ 7 V; x( v1 t, B; B; S0 }" c
simple.CloseModel();
: E' h' j: [- e7 F WScript.Quit();
4 c. q! J0 K4 S# O$ P1 b }
0 ?2 D1 W1 M! @) |$ S}
4 S- F* p+ v: B" R! L8 {7 p ) Y. v2 v8 }! W0 D) p
simple.StartSimulation(".Models.Frame.EventController"); - x$ M |' a+ A; K Z! J
. I0 Q3 }% r, C! J( r: j
if (simple.IsSimulationRunning())
: ~/ y# R- N# D; u1 x% f* w- B. A+ H WScript.Echo("Simulation is running!");
- \0 r3 j, q% g# D: A; y! ] / M, K$ N+ ]: T6 q/ M; q2 F
// Wait until simulation is finished 2 A, b" S8 P/ L
while (!Finished) WScript.Sleep(2000);
$ j3 ~/ g/ X$ N* w* M! B* N ' s$ ^$ P5 x1 |1 v; x- ^6 K
simple.CloseModel(); : S' t1 @9 m: K: ] s) Y2 R3 ], w
simple.Quit();
# J, G: }- A( Z/ U S' x3 PWScript.Quit(); . e; W% Z1 e2 T5 F3 z
$ W& A* Z- M1 ]/ @# D+ b) C" Y
9 P2 W7 X, m; E- Zfunction RemoteControl_SimulationFinished()
1 Q/ d, I1 y7 }, q/ [& b( ^; p w{ 4 w; v& P* J" Z9 I$ O
WScript.Echo("Simulation Finished!"); |