Example of a JScript ( U% Q" g$ Z' C5 r2 X# _# v- e
var vbOKCancel = 1;
' p9 Z; L# z! L5 {var vbCancel = 2; & {5 w" d$ G$ c/ J/ b! W! v! y6 }
var vbInformation = 64; 9 Y: \ Z$ P" g9 y
var Finished=false; ( F6 [+ Y0 h/ m4 p) K
% d. D/ y/ e( j
var WSHShell = new ActiveXObject("WScript.Shell");
( }7 U) g3 p2 T7 P; S% K' D$ l
- k/ X4 n- E& v! b4 K4 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # m2 i+ T, s" Y& w. i
6 D4 U0 }/ |, ]9 Ssimple.SetLicenseType("Runtime"); # c1 P) v3 g: q# [7 v
+ T/ @; i1 Q) G3 Ptry 5 r7 b2 p% B: f, T3 {. x
{ ! A: N+ u0 \7 \2 C* H+ E' ~6 ]* Q
// Enter the path to a model file!
& u- f. l) V0 C1 H: N simple.LoadModel("C:\\Models\\Test.spp");
- I0 \1 g6 c( z' { w0 L) d} j" X+ J2 h% d$ P6 w5 D# r3 C7 o
catch (e)
7 o6 t' h- B3 G- a{ * p2 ~4 U4 Y K3 }0 W, B" d
WScript.Echo("Could not load Model!");
8 C$ ?& j3 c! p. ^ WScript.Quit();
5 r$ ~: _# d9 L4 L3 ]+ W} ( A8 f1 A1 ^8 M' ^, v
$ }, G0 n8 |6 mtry
* h0 S* m% S/ ]( ^4 }1 Y9 R{
2 d; Q3 Q/ p' ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* e: B8 @( H) ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( [% f- M# d+ U; a- a% j
if (r == vbCancel)
1 _. X4 ^/ h+ j9 ~( E) E+ @ { / k6 E- P- [% J- `2 V# m d' O" H6 H
simple.CloseModel(); % Q. Q# ?9 \; ~5 f h4 n
WScript.Quit(); 6 X* A6 p$ W% ^( c4 V: [: R
} 3 Q* d* F0 f) S+ {# L' E2 u
} ( J# n* p1 }. S& T, K
) E$ X8 U9 |' |/ x' c+ K
simple.StartSimulation(".Models.Frame.EventController"); ( L/ r. O' V, V7 m/ Q
0 N- n% X# F- l" Bif (simple.IsSimulationRunning()) $ H. W4 J7 [% |3 W" z0 d! h: N9 k
WScript.Echo("Simulation is running!");
* y, f% U9 Z; y6 I7 a5 ?" f
0 [" @2 V, B! Y& q1 Z- i/ ]// Wait until simulation is finished
/ x$ J! l4 b1 D$ j( Swhile (!Finished) WScript.Sleep(2000);
9 S, v2 ^7 O( H9 |1 y2 m9 U2 V, k) \
0 M6 `$ \+ E) H3 u) t* Wsimple.CloseModel(); ) f1 H7 m5 A) g! Z$ \
simple.Quit(); 9 M7 i1 y- ]: s3 f8 |- d1 J
WScript.Quit();
& q6 F7 t. g: U6 P* i6 A 2 [& |8 ?1 m- |2 {* H6 \
4 m) m: S. y5 d- Z% x
function RemoteControl_SimulationFinished()
( W% k! J9 I. {0 @+ {* {! H( h, W{
# L v. U+ d/ X+ T. n WScript.Echo("Simulation Finished!"); |