Example of a JScript / [1 f# X: y! y- q
var vbOKCancel = 1; 2 j% T& l- {1 h* ^. ?
var vbCancel = 2; $ F9 G6 u- i) r8 s
var vbInformation = 64;
/ k, D7 @) V: ovar Finished=false; ~9 {7 {$ y) F/ [ m
]# c \6 a2 A9 i1 @: M
var WSHShell = new ActiveXObject("WScript.Shell"); }. w2 q( ~" y# z4 F; k
5 m2 w2 k: N/ M) n8 A. z$ E* J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 y2 o: I) L7 _) U, \& {+ M# Y( [7 ~
' x1 q: X9 f6 ? g) Csimple.SetLicenseType("Runtime"); S2 X& T4 F1 L6 {
' U8 p4 O" I$ U
try
9 }% q `$ x' W) ?. v{ : [( e8 x, @2 w9 |& t, W
// Enter the path to a model file! 7 v* f+ m5 T( b, t( j5 g
simple.LoadModel("C:\\Models\\Test.spp"); ; w" C+ O9 j) g8 `1 Y% Q
} 6 {; Y: W4 C8 v4 o' B; A9 q! {" _
catch (e) 3 a$ A6 P5 u) @6 s" Y
{ 5 g% ]4 d5 d# f# I- J
WScript.Echo("Could not load Model!"); , F+ V' n6 w" M& K/ j: K; X" r( w
WScript.Quit();
1 k4 _( H* I0 \7 ~1 t% D4 E} ! y* o; c1 }3 v1 l V/ n% p% X3 |! A4 f
8 @/ C/ j& s1 V
try
& f4 }, S1 Y# y! F* D{ ; o1 k* M+ M7 a% ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* S. A$ k" |8 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - t1 C4 N% t$ w8 D
if (r == vbCancel) 1 O* _1 Y3 p, E- O' D# Q! z
{
& t" ?- C. c- v1 Y, {" ~ simple.CloseModel(); " O$ E, c, z2 C' w0 D$ o, S" m
WScript.Quit();
& U# a: M7 _5 U/ ~) n2 n }
& \2 M2 Z3 B. a' P3 J- O}
6 H; l' J! ~- M" T0 p
0 z: V( e& k( q) J& p) k' n: _) ^simple.StartSimulation(".Models.Frame.EventController"); 6 V) ? ]& P4 Q8 U7 d
; v8 K1 |- P% `% y
if (simple.IsSimulationRunning())
5 B1 z9 ~9 B! ]/ U WScript.Echo("Simulation is running!");
: S, g6 e. p8 }1 Y _/ O 8 \/ \& l( ?8 x4 u+ T- w
// Wait until simulation is finished
+ y" o9 s& Q0 Q, L% d& ^* ], [while (!Finished) WScript.Sleep(2000);
6 h# J1 I! A4 N2 o0 x9 y8 m1 g
5 n w% ^! X, v' u: |: s& o7 q0 Esimple.CloseModel(); ; Z: f; A" {, t* t6 O6 O+ N
simple.Quit(); % A i2 K( H8 x4 V9 M
WScript.Quit();
/ u. X4 B& ^7 n- J1 n% \0 |+ s+ _ / O: Q8 F6 B/ y& k G
+ ?8 W' l% U, A, u/ p" H1 f
function RemoteControl_SimulationFinished()
5 n9 T! m$ {7 h3 q+ N{ G9 a) b* O" \8 I+ C; Y! ?
WScript.Echo("Simulation Finished!"); |