Example of a JScript # S$ P* G) I9 E* Q! f
var vbOKCancel = 1; 8 Y9 x5 g, i: _- K; m/ n
var vbCancel = 2; 6 O% H$ ?' G2 l
var vbInformation = 64;
, [( b7 b* P: R- jvar Finished=false;
. K3 g" K G0 B- o7 f. |* v
% K5 r8 d5 C% i) R# rvar WSHShell = new ActiveXObject("WScript.Shell");
6 L6 G) p9 Y& U3 M + N9 F2 @( V, W4 T8 E' \+ k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + Y6 w, v- E( [3 @
, ^% O( q) t; `simple.SetLicenseType("Runtime"); 5 g- z1 D" ~9 a. C
- p4 d! g: K0 S1 }- atry , Z/ U! G+ I6 T4 |: j' z/ `8 @# C( a
{
" f' {6 } z) f- p1 P // Enter the path to a model file! ! B8 a5 D' C4 X S0 w$ Y' ]( J
simple.LoadModel("C:\\Models\\Test.spp"); - U- t+ s/ n2 K; D7 M. [, q
}
- K8 k& N4 s/ \- n5 |: [catch (e) . o y0 g9 u4 E
{ 0 u3 k3 ^5 h$ {4 F
WScript.Echo("Could not load Model!");
( E! n& `0 i8 ~ WScript.Quit(); ) P7 w# j9 H4 y1 z# {& j
}
8 K( e: y4 l/ C' s7 Y1 W$ b! B
5 B% {. G1 M3 a7 Q. ctry
& F% W1 d7 G* B{ % x( E$ {7 f2 Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 U$ a% n- R* Y% H" i9 L r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 e( W7 }" n7 e9 j5 B if (r == vbCancel)
$ t2 i( h7 U; O6 M Q4 @: Y2 X( _ { - |) l6 s; W& G% h0 n3 d
simple.CloseModel();
! s! D# O4 Q+ ?! t WScript.Quit(); 7 m1 @% B2 E. b/ C
} S1 u( e, R3 r$ b% m
} + n2 @: b; O) N) b& n
3 A( h1 d' S* ]9 ~1 m, Qsimple.StartSimulation(".Models.Frame.EventController");
: F& t- I' l/ p2 j: |9 Z
; {5 E: g* a. N) `+ ~1 u9 @if (simple.IsSimulationRunning()) 4 E# V5 B; c8 M, F0 t5 p
WScript.Echo("Simulation is running!");
. \8 l, M. b2 |4 z3 X
6 c/ z7 W$ J, g o, _" Q; g. w// Wait until simulation is finished % U; s. \5 D1 c: M: @
while (!Finished) WScript.Sleep(2000); * x/ a7 [9 t4 X
, U ~# m$ L( l! L7 p% rsimple.CloseModel(); ! T$ d. e& ? B5 ^7 C
simple.Quit(); 5 s$ \3 u( t. x; _
WScript.Quit();
1 ~% u( p/ S, }0 b4 O7 H 0 b: M* q$ X2 e+ d/ e3 Q
7 @- L w+ W( |! ]. g% [$ Zfunction RemoteControl_SimulationFinished() 0 A) [( K4 f; w( ]2 E
{ " B. S; B( J5 i
WScript.Echo("Simulation Finished!"); |