Example of a JScript 3 m$ p6 r6 H& m- j7 r
var vbOKCancel = 1; 5 }& u! `8 |- s; f; p8 ~
var vbCancel = 2; ! ]( W) h7 f! F
var vbInformation = 64;
( c; W% N% e" B/ L; ~var Finished=false;
1 E5 [: F( T5 ^) u3 k! a
- \9 G3 `" L. `: x5 zvar WSHShell = new ActiveXObject("WScript.Shell"); , t1 ~% A: i& Q4 T0 O3 ^- z
+ _7 |" x2 J' g6 X7 Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , _8 k+ m2 J" i# H, x" M
0 c) B* A D5 X4 [; J+ P4 X& \9 ysimple.SetLicenseType("Runtime");
( a4 E5 ]! U1 ^5 K. T! @! L; I ( ^/ g2 [/ \) [$ o
try & r5 C) _! f" I- y# w" P) b
{ R7 g7 h0 K% d; q+ F/ M
// Enter the path to a model file! $ F$ N* r) Q7 t+ _7 B* ~7 P
simple.LoadModel("C:\\Models\\Test.spp");
( K, y. D1 T- M9 E} $ ~$ r( Y/ b5 L: U2 e; w& H4 W" X
catch (e) + J) M p5 @% M. b
{ " U' m7 h7 [( i' q# T: ?
WScript.Echo("Could not load Model!");
6 \% d/ P. G0 @ WScript.Quit();
0 a4 d, h- [8 ]. o} 9 v8 V$ p' t4 M' @! G& j! P& ~
1 d/ P+ [7 _& i9 c' J% K4 rtry - y/ p& l' [& E9 c5 u
{
! D# Q2 A/ _6 Y5 r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 f2 T8 }* z: T8 G, b2 _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 i) K! Q# u0 y4 b8 ?4 B if (r == vbCancel) ' |1 F _$ p; D1 t) T
{ + Q1 {7 w- i* H/ ~( o
simple.CloseModel(); ( D: d( l# m( b1 u) r
WScript.Quit();
! W% A2 a( c8 ^ P; g) V }
# c Q1 O8 D9 r1 c& J8 f} 3 T9 \* |& g( L% Y+ T# j: u) g, A
0 ^8 r* O {3 m" G+ n8 f- }
simple.StartSimulation(".Models.Frame.EventController"); 2 a% l+ R# a+ r$ g! T9 |8 B
) C, o& Q+ v! ]" F& D# Oif (simple.IsSimulationRunning()) 2 V8 c/ Z5 |% i. ? n
WScript.Echo("Simulation is running!"); - F) u/ h8 w b( v% {% Y0 j
$ a0 T9 ^% o4 G5 w2 T# R// Wait until simulation is finished , a' m6 W1 ` m. u2 w3 |3 O
while (!Finished) WScript.Sleep(2000); 4 R1 d6 C: ]. p' x2 A& s3 L
% _1 d/ W2 f9 N" h9 ?3 l1 Ysimple.CloseModel(); - l0 W5 I( T3 j8 ], }: w4 }
simple.Quit();
- D; g0 l( K8 F/ S: Q- `" EWScript.Quit();
' F0 r+ N( U7 p$ T b 9 d: l/ R: x' t3 G1 E% u
; F+ U, K' ?" Z c; d
function RemoteControl_SimulationFinished() 5 C. q: o/ L2 M5 ]
{
. J/ V' ^4 \. U; t* B6 F WScript.Echo("Simulation Finished!"); |