Example of a JScript 2 i$ z5 e j' I( }" o+ c
var vbOKCancel = 1; 1 g4 U I `* _# q; O8 m
var vbCancel = 2; 3 c6 z% E, \+ e3 Q6 Z" |2 l
var vbInformation = 64; / g9 s6 n9 H. ?8 m
var Finished=false;
* n7 P, p: s9 l+ i1 w
4 Q4 }# M* k5 w' `# T0 Nvar WSHShell = new ActiveXObject("WScript.Shell");
0 r& I+ x' y: E2 N. M3 V
9 \0 a2 `7 ~8 L& G2 k* \9 mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . \- s* b0 o! v7 n" ^6 v7 \+ L/ W
# |) X7 P. v6 Z5 {! L7 Nsimple.SetLicenseType("Runtime");
0 N/ w! Q$ Q: Y: o0 i" x0 A
" _( H Y1 F2 Z7 Q: i4 ]$ M* mtry
/ O' `7 X @$ z5 l- d% d0 q{ / T! a; P+ x! D3 G/ A6 ]
// Enter the path to a model file! 0 E v, P8 J& R1 b
simple.LoadModel("C:\\Models\\Test.spp");
, f2 h3 i) V! q |& S, @! I} : K8 u% Y2 [% ~8 |# n$ i
catch (e) 3 ]" \6 W4 U' o5 C6 p' ]+ O
{ 9 D# ^7 `9 M& X0 ?: b+ @, X* f
WScript.Echo("Could not load Model!");
0 E& R$ L: z* m WScript.Quit(); 9 O* B9 o% h7 H9 O' z
} 5 E* n* h6 j) I. j! Z# O& X0 O
: y1 p4 K( {2 Y/ `& I/ ]) c' Btry
+ U8 F$ U; [8 p% C! e; M{ - {& o) q) \! T1 c3 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! ~" x n9 ]; Q' J3 ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! i% e. L: ?8 i7 G if (r == vbCancel) 8 n6 d( W+ S! G0 F. g- `
{
. l5 h" C" @ Y simple.CloseModel(); ; Z5 `" Y% C( ]- z* T/ J* Z
WScript.Quit(); , n+ x) n0 F' p6 j# s
} ; R* S9 K! e6 i/ [8 _" \
}
! N* }/ Q' p" E2 R* x 4 E' v! p; y$ V: t1 K
simple.StartSimulation(".Models.Frame.EventController");
. Q$ {0 Q* W0 \8 j) g ! _6 f. ]1 d. J- k
if (simple.IsSimulationRunning()) . T# |2 {" l( U4 r J2 Y4 e. }- p
WScript.Echo("Simulation is running!");
0 i9 n/ q! [9 t. a2 X! |3 E
2 t. \8 j6 o& F2 |2 W// Wait until simulation is finished
/ t& s5 [( x+ H- P1 Hwhile (!Finished) WScript.Sleep(2000);
2 O, E6 f5 `* C& q2 h F1 X" J & e6 G1 h* Y R% J9 j$ O v* ~
simple.CloseModel();
4 _) l5 d$ s t$ u2 Ysimple.Quit(); 1 a+ }6 H; H( |' ?+ C: S
WScript.Quit();
% [$ L1 v2 E; z6 Z, Z6 s( C- b7 g' R
4 p" ^3 T, E' N' f
3 y I Q$ ~! Rfunction RemoteControl_SimulationFinished() / q6 R1 U% ^2 X6 @2 U
{
A+ i" o4 `/ K WScript.Echo("Simulation Finished!"); |