Example of a JScript
2 _" \5 i" a" evar vbOKCancel = 1; 8 d. X- l' _) Y& ~/ W
var vbCancel = 2;
9 @9 B+ H$ g$ b$ bvar vbInformation = 64; + P% U# c: [ |+ y* W% V
var Finished=false; 5 }. c+ r4 \( {; D! w+ \3 D
$ W) `/ b' G" a4 `3 _, Svar WSHShell = new ActiveXObject("WScript.Shell"); ! _' f! E! a# Z, V v8 D2 `8 E
+ x" V+ w( x; [* w7 {( b( V" g+ ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ I$ b9 B' m6 S+ L
* T: Z( c; ^/ w/ O# n* [simple.SetLicenseType("Runtime");
1 o. I$ \8 w c0 s% g$ A6 z) s0 h 5 F1 z' M4 V6 ?
try
' t8 n5 X: p, H# D( S" O, x{
[2 x5 [* C* d% X8 r: L0 ]( \ // Enter the path to a model file! F; B) t, e( ]) ]. }
simple.LoadModel("C:\\Models\\Test.spp");
4 P& d. h0 D; e3 h% l, v, V}
/ |8 O5 [) u2 |9 f+ d+ ?catch (e)
. p: E! a8 k" X y/ \0 x{
# q& ?$ ~4 z8 g5 b WScript.Echo("Could not load Model!");
# W- W5 n' h7 G6 L. {6 f. m WScript.Quit(); 8 g( r# ^: N M3 n) u5 j
} , G5 p2 Q/ Z; z- c _) n6 L% e
: u- p; c" @6 M$ K3 L: m8 }try ; g0 ~) U" f" W8 Q& N
{
' H0 A: ^" A: K+ W& S+ B4 }# B- A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
J/ ~1 i* @; x. J9 N9 { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ' x5 y' n: {! l2 @
if (r == vbCancel) + o* Q6 J4 Z9 \* j) ^1 q
{
0 A: n$ v( a) M% {( r+ \# J simple.CloseModel();
S' ]$ {' V, z9 @2 h WScript.Quit(); * y1 s7 n, X+ o6 t3 s" N/ q& H- |9 o% P
}
7 P1 A- x4 M! V! v% x& s}
7 Z# q7 C; t* L& i , Q6 K0 Z* K3 T+ X
simple.StartSimulation(".Models.Frame.EventController");
7 T+ i, s& A& `; o; R& ? 7 i# k0 b3 A! C% X6 m
if (simple.IsSimulationRunning())
* B7 C+ @2 t8 \ WScript.Echo("Simulation is running!"); U( X# v- J" N( z
0 A2 V# g; s: i- i
// Wait until simulation is finished 3 W, g/ w- b- K" t, `! P
while (!Finished) WScript.Sleep(2000);
7 o [% X+ @7 `( L1 [- s - z3 W6 K+ q" |( u! \
simple.CloseModel();
% O! z$ T3 M4 a- Z+ K6 R5 Esimple.Quit(); , l8 [1 u8 j+ c* \9 n
WScript.Quit(); 6 M2 Z2 u; F% M5 n( |$ w5 c+ s: K3 `, x
- g1 L3 o$ f0 e
& B9 o5 B; L3 o7 Gfunction RemoteControl_SimulationFinished()
4 }& B. p9 J4 I7 G{
; u& [! Q1 J. z* Z# l Q0 M( Z6 t0 m WScript.Echo("Simulation Finished!"); |