Example of a JScript
# X( Y6 y; p- }& _6 N7 gvar vbOKCancel = 1; ' Z6 p2 a# Z* x/ l0 F
var vbCancel = 2; 2 Z! g6 g$ v7 R/ U& I
var vbInformation = 64;
; x1 M6 l0 d" jvar Finished=false;
- P3 K2 [0 ] F- k
' L! v/ d$ D: F+ l# Yvar WSHShell = new ActiveXObject("WScript.Shell");
v% b9 C |! }3 w( @
. i* \5 @( B9 Q! _3 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
D* w, [( s( h
& ~3 G6 I/ B% p$ q7 B- t( L: h# P6 lsimple.SetLicenseType("Runtime");
, r/ {( H% U5 a4 C6 n8 m # b( @7 x1 U& X' [7 `9 H4 V4 _2 h
try " J1 O" ^0 R& P
{
) w" `! Y+ S- \% {3 R // Enter the path to a model file!
, [3 _2 v' j% o" q" i/ k0 U7 Y+ s simple.LoadModel("C:\\Models\\Test.spp");
# r3 S. @; b# Z/ @}
9 E6 \! G! f& v' Z, ~0 [8 @catch (e) % ^6 A! J2 P3 G4 e1 s
{ # o" P4 J0 S5 m! n
WScript.Echo("Could not load Model!");
" ^+ G) C( A2 R$ K WScript.Quit(); - z- f( M. }' R g1 k! C
} & k1 A9 Z1 B; k5 R/ {
" l$ i2 f* W4 o7 J& j0 Utry
5 |' J% ?' I% O4 t$ Y) j4 X# B3 r{ 4 h9 \8 E0 g( \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & p( p3 Z1 r: V5 h6 i& o% a( X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / P3 |$ ~7 h S) n# Y0 f7 C
if (r == vbCancel) % F' S. t$ g! j; H5 [ v6 E& x2 o
{ 6 q+ G- U( k" C# S
simple.CloseModel(); 2 d+ r# ~5 R7 T6 N. y$ r
WScript.Quit();
1 T2 x1 M/ x9 B' f } 8 Q4 Z5 k. |# m: o$ [9 ]
} 4 g' \9 q9 U8 n. e, T+ P
7 k, ~+ _* i( C% p% F' S, `
simple.StartSimulation(".Models.Frame.EventController"); , R$ |& Y8 f+ d2 y$ \; C; B
8 W4 C- I6 R7 {( C# n; s$ U$ Bif (simple.IsSimulationRunning())
3 r. ~/ Y6 W; R0 j WScript.Echo("Simulation is running!");
/ h; d, g$ p& }+ f: u4 V 9 u# [* I: a- y. K+ u' ?9 L
// Wait until simulation is finished
: ?3 D( L6 y7 T$ P! ~while (!Finished) WScript.Sleep(2000);
4 z+ \9 M+ E" e) t- }8 S0 P ; \& p- z: _' |: C
simple.CloseModel(); ! |, q% p( F& V; q" v$ Q0 t
simple.Quit();
- d* z5 x3 Z- p+ S& qWScript.Quit();
2 X- \+ Y$ j9 n( t6 e
* w7 N$ y! U m' h+ U
! x* P# z, z: v- g7 A2 _function RemoteControl_SimulationFinished()
. q; a' \. C/ u0 H; @' P{
2 g5 Z3 i; C/ i3 ~ WScript.Echo("Simulation Finished!"); |