Example of a JScript
* N0 \3 b1 W4 e, q& K) i$ hvar vbOKCancel = 1;
7 A0 x0 X [1 P; i+ c0 |0 ivar vbCancel = 2;
% q( w, x4 |3 g8 wvar vbInformation = 64;
( Q0 Q2 s% w* Z; avar Finished=false; ' e& V6 q4 }6 ?- `3 @4 A
: C/ o/ N) A4 ~% `- P$ svar WSHShell = new ActiveXObject("WScript.Shell");
+ E; d! q* e- G% _ 5 M V7 D/ B8 T! ?9 |$ V* s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * ?' D7 x9 `+ f+ t# t- P0 Q' q* n7 N
" j7 f3 ^% c4 E" wsimple.SetLicenseType("Runtime");
3 t) k. b) a- ]: b( q0 O6 M / Q+ K* A# [5 }) H& z
try ! k, E7 k0 e0 o5 V! s+ R8 y
{ S+ U9 k& J# Y7 F1 `
// Enter the path to a model file!
/ \7 _4 ]+ K, F+ O& ` simple.LoadModel("C:\\Models\\Test.spp");
0 {7 q% H- [: m, u3 u* U- l) D} " K# C/ Q! ^& _! F9 D7 ]' O
catch (e) ' D- G; }& \6 l" s
{ & |$ X- i! G |, {+ i, m9 P- W" x* G
WScript.Echo("Could not load Model!");
- t5 X# `5 X0 X. ]% B. E$ x: a& w+ I4 M WScript.Quit(); - T* O. n; t" o) t0 ~- |8 }# X
}
" [0 O6 v9 a3 V * P. d* S; l) K- L
try
# |& k1 |% i# o+ Q9 ]2 C{ 9 U2 L! y$ R+ c7 |5 o0 F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ i) a2 S, I$ z7 n. T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
l+ H5 J4 c" r if (r == vbCancel)
4 p# a/ B4 R6 D { ' @3 D0 g6 I+ P* ~3 ]8 d9 J: G
simple.CloseModel();
" J; |1 T, f" v6 h/ R+ p6 m) ? WScript.Quit();
& O5 Y" N; P* ?% r8 _+ [% P7 q: f6 J }
+ }1 O; ?. M( L9 j; `} , P' O( Y4 z, m# l: Z |
- |! x# [) Q" |
simple.StartSimulation(".Models.Frame.EventController"); ) S: H/ t6 V- H' F& p* A: m
0 t% r; V" ~. M2 H* e; T/ L
if (simple.IsSimulationRunning())
. I) j7 \3 d6 b, E( H WScript.Echo("Simulation is running!"); 1 X% L9 O/ g/ H
' O5 ?1 T* r2 w0 x2 G4 F// Wait until simulation is finished
* m8 C0 x# _# i% twhile (!Finished) WScript.Sleep(2000); ( J1 [2 N+ }% R: b2 Z
]8 g6 C2 s& L6 E* s
simple.CloseModel(); # f+ h+ ]- c- d7 |
simple.Quit(); 8 n1 U" y/ G1 ~( U9 a
WScript.Quit();
0 e6 W' ~( v" k
" V% `7 Y# x2 X; Z ! C4 _! T' C1 l4 _& }
function RemoteControl_SimulationFinished()
. d& {' n1 L/ b2 Y{ / T$ L+ ^2 W9 ~0 t) }7 d: V' \
WScript.Echo("Simulation Finished!"); |