Example of a JScript
* r- n0 S6 }: yvar vbOKCancel = 1; ) }3 v" ^. p! _( Z3 L+ M- L4 q
var vbCancel = 2; ' K7 I" }. B$ B6 ]
var vbInformation = 64; 3 r: J E5 e+ u5 C& n& d9 w/ J2 R
var Finished=false; 7 Y# k* P; G) b/ r+ L
- M W7 b+ U1 v8 E
var WSHShell = new ActiveXObject("WScript.Shell"); . Z/ d. t9 i; P8 ^% L5 u2 m0 n
! X+ G( V3 C2 E5 e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % ~7 b, K6 E8 F9 K, y" p
; @3 x& c: H& N* [: Lsimple.SetLicenseType("Runtime"); 3 n2 i3 U+ n4 D% c* y( ^4 D7 U
, g. i; A3 T/ b+ V
try . D7 Z+ l6 V% E+ O1 M# n4 u
{ * M5 {: @. q; |/ C( W8 r7 Z5 W, N. C
// Enter the path to a model file!
; s, A* l7 Z) M9 }3 ~7 W. p simple.LoadModel("C:\\Models\\Test.spp");
& g% w# r# i, \0 M( w: b} 3 U2 v& w% n/ b+ n, y7 r9 L
catch (e)
* D. p$ z3 ^* C, \{
& J/ s! K: R' P U" f7 } WScript.Echo("Could not load Model!"); p- S2 t! `) W5 s
WScript.Quit(); - x) b9 H2 Z0 ~. m
}
; d9 @. b9 Q7 t
- l2 n/ `7 G2 Etry
8 \5 A, K( C" A2 F{ 7 V7 M8 r# ?& ~, S; g3 Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) ^/ I! }5 P! g2 R% ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 I" d" E% q( b8 {6 P8 c0 O
if (r == vbCancel) " h E3 H% M% }3 u) f4 P" a) q
{ 5 ?+ C' q1 i d8 l" B) [) V- m
simple.CloseModel(); ( _! k9 y* I% T" x: A+ M
WScript.Quit();
Q% F2 K" L! J8 C1 F- Y+ R( a$ | } 6 u1 _, U6 L* J
} 5 Z3 a" }5 F3 K ~
7 n# o* c9 z) w/ a& N# q) x
simple.StartSimulation(".Models.Frame.EventController");
- X4 c% u/ r) u" M1 b
( I* n7 o5 y1 P# f& ~( p3 Fif (simple.IsSimulationRunning())
# y+ x" r& T& _0 }1 P" Y( C WScript.Echo("Simulation is running!");
. ^/ [/ ~$ `1 s$ n - h$ I* ]) Y$ r( w8 V# v+ Q! V
// Wait until simulation is finished + V. V6 _( X0 c+ m# j( N
while (!Finished) WScript.Sleep(2000);
) U* `3 b/ D' {+ Q2 v ( F0 y4 I/ l7 t0 M2 }4 C
simple.CloseModel(); ) z4 k3 R6 _6 [# u, H
simple.Quit(); # J0 Y2 d$ l$ A! Z! o5 V2 s! i S6 Q
WScript.Quit();
+ `7 d* J" F# t7 R
# H& K# D3 M3 O& e9 _$ x 4 L: }. o1 k: Q# _2 r
function RemoteControl_SimulationFinished() # H& D# w7 c& z& O! C ^
{
: U3 {( V$ s8 ]9 E WScript.Echo("Simulation Finished!"); |