Example of a JScript ) S q$ B' i4 j- Z3 m- P) F8 a
var vbOKCancel = 1;
+ C: d& |0 o* k& v( D/ {var vbCancel = 2;
! G0 h3 g9 F& i$ j& ^var vbInformation = 64;
S' S& v- R/ | t% v; I1 @var Finished=false;
+ R" p$ m' ?' z! Z- U. v. V8 L ' i% I4 z7 [% g) r
var WSHShell = new ActiveXObject("WScript.Shell");
1 C$ Y5 t7 C& \# _) s
6 y4 d2 |* x" R7 t: O, ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! }& J3 g. ]9 @4 U
& n7 h! i H6 A" |( ~/ b* a" C* c
simple.SetLicenseType("Runtime"); 7 W4 a1 _/ U/ i# R# Q, |4 `" A
1 O( d% ^1 R/ \; _ ~try
T' c1 L: y3 q$ X{ 9 [, U$ u" P+ T# w4 A" u0 Z
// Enter the path to a model file! " t+ Q2 g; j$ m" W
simple.LoadModel("C:\\Models\\Test.spp"); ( X& u( @* K! I" a) v# w
} . p$ d% r; A8 q L
catch (e) 2 {$ ? V; M; g3 Z P
{
- }' n1 p. s( X' ^ WScript.Echo("Could not load Model!");
4 [# S1 X4 I' b! C9 N( Z4 c8 w# c) k, d WScript.Quit(); . J( Y* R) V4 Q- \; I. `
} 8 ]* Y; s+ d) n x5 D! y4 P4 @1 Z
0 Z: [1 c7 Z" @0 `& Y8 D7 ~try ) \( G- e: }% x. k) {
{
0 N8 c! Q: C8 J0 R) A* C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ?% H3 {' u* a8 Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " x5 c) U8 P' [# z) G; \
if (r == vbCancel)
3 G2 _5 m$ Q9 i( @* H { 7 P. i. W; P5 V# U
simple.CloseModel(); 4 Q) m, }$ {/ m, g) r1 I
WScript.Quit(); 4 u3 z) `7 K1 [7 k% j; N
} 9 D$ Z% \$ R9 z1 s B9 R
} 8 b2 h) j* w; B# \6 A: e. @8 [
4 l2 N+ a+ U4 [simple.StartSimulation(".Models.Frame.EventController");
- |% R U! h' M- P
' j% M! h/ a7 M2 [if (simple.IsSimulationRunning()) ) y Y2 f# R4 s7 {) v7 Y
WScript.Echo("Simulation is running!");
$ x3 E- e2 E# [1 [9 s 4 |9 v3 j6 V s# Y0 D
// Wait until simulation is finished
5 h5 u9 @) z& |' d6 [3 A( rwhile (!Finished) WScript.Sleep(2000);
/ a8 y9 s8 N$ e' w- z! R 6 X) @, G7 h( D( T" A, x1 a6 L
simple.CloseModel(); ! }2 N# w |+ S& d7 c* U
simple.Quit();
& R, e' C, ?# q# b- _; ]3 rWScript.Quit(); 8 Q% N& |8 ?/ z- F
; @% ]) V" ^5 G* Z
* _0 `2 _ g% q! d- s- f' H5 n
function RemoteControl_SimulationFinished()
0 H0 {7 _4 u. o* o- J" }{ 7 ]8 X; i1 v/ T" X& F
WScript.Echo("Simulation Finished!"); |