Example of a JScript ' `2 F, S4 G# t! P7 E J( j
var vbOKCancel = 1;
$ ~6 T. R( z& k& Q, C1 K1 p9 p1 Q% nvar vbCancel = 2; * ]' B' C3 [/ v+ ^% _, F* a1 Z
var vbInformation = 64; $ x9 O A+ ?6 p# u1 P! j. r4 q
var Finished=false;
4 S4 R# r6 a! |$ a 0 Q2 j! L! r" S, r- L
var WSHShell = new ActiveXObject("WScript.Shell");
: `" o5 K2 `3 x- z9 g7 o7 G
, ~& ^5 J$ N$ z3 pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 a/ B, C9 O5 k( T: E
- {9 L( F) V5 C* v/ N" _; g5 k, [6 fsimple.SetLicenseType("Runtime");
$ ~1 O" i! W8 o6 {' W1 a
- O+ |# \- ~! J/ h9 wtry
$ f- p. @9 u* s% i$ @. {5 j1 Y{ % _* l* W; d q# e
// Enter the path to a model file!
0 e% C3 Z I% V& y* |: r. C simple.LoadModel("C:\\Models\\Test.spp");
9 j! ]4 p% r/ R" f1 B! c} , U" q# r* V4 d% P
catch (e) 8 g$ E9 _1 U. r9 v; M7 p; K, h
{ 1 T; k* X- [6 E" n! B1 R& n
WScript.Echo("Could not load Model!");
7 l8 o& i" O* Y6 ?2 D WScript.Quit(); ) g1 g, f, c- e5 Y' U
} , e" G+ |7 [5 {0 f$ K5 R) D* P
7 Q7 y% R- R5 j% Ntry ' b* c2 b! ]- t. f B
{ 9 T$ R9 G' f$ A( u% b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
! ^8 }: d$ c$ d6 ^4 Y) k1 ?) L r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( O) S) t- b1 ^: `* V
if (r == vbCancel) 8 i4 g8 o/ W7 V
{ & Q7 U4 R7 I% G1 q5 g% O3 D
simple.CloseModel(); ) r3 w4 f8 e: g; L8 h
WScript.Quit();
4 j. O0 Y* V. }" v( ^4 Y }
, ^( L* c( J, ?0 G" A+ |6 R} ! C# ]4 i' i) A* \4 F, d$ f
' @5 G" Q: r9 j L9 F
simple.StartSimulation(".Models.Frame.EventController"); 2 e9 i: \; m Q" {8 H
' b$ i. B& |9 y) K) A9 L
if (simple.IsSimulationRunning())
8 ^6 `, s: H& y: P WScript.Echo("Simulation is running!");
, t7 n( Y' _# r- _ $ c, p3 B1 s6 v1 e9 V
// Wait until simulation is finished ; m$ R6 ~" ^7 E) [; `
while (!Finished) WScript.Sleep(2000); 2 f5 R, P3 B u& b* H# r8 t3 O
; G% \- ?8 h) [' S& T( ~8 d5 w& nsimple.CloseModel();
9 q8 M, b( Q- l8 p5 A' y, Hsimple.Quit(); 5 g5 H$ c6 v' }5 q% U* P9 U
WScript.Quit(); 3 X, j) |7 d8 \" w, ^
8 n) g% _4 |2 o" Y" s! `+ R( H
% I7 u+ G6 _2 h8 D+ {* Ufunction RemoteControl_SimulationFinished() , _* _7 | ?6 q8 P7 b+ {
{ : x) J' ?7 L( i2 U
WScript.Echo("Simulation Finished!"); |