Example of a JScript
* C& m8 l- f! g% u/ r1 B" M1 n3 Hvar vbOKCancel = 1;
y, G6 ~( }: l" i. p1 R. ivar vbCancel = 2;
! W8 |" b7 J! r3 O G: U3 jvar vbInformation = 64;
8 A6 \) H+ S6 D! J5 _* N9 m bvar Finished=false;
: U6 U! o _8 x! i$ k5 P9 t % G/ ?& \1 O! g1 S0 j
var WSHShell = new ActiveXObject("WScript.Shell"); 1 Z* X5 P3 Z$ Q0 X8 F
" l* d0 \% M2 T2 b; D% x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ _2 N* C! l% U, a 1 ~( f% Q4 x& r5 s5 F6 Y) u
simple.SetLicenseType("Runtime");
$ E' [& X( n; ^. X. @1 I- x * P; i- ^; t5 w. M0 }* ?8 U
try ' l9 w E6 c# y! t2 y
{ 7 F* K/ _! G$ f. x4 t# D( j: E4 K
// Enter the path to a model file! : q8 M& A5 E% o1 V! S# L" K4 `
simple.LoadModel("C:\\Models\\Test.spp");
; w0 V& e9 w6 _1 C2 Q! x8 f}
' {7 }5 F" p8 a( g# V6 ?% v/ hcatch (e)
$ p9 e9 X% W1 x& D; |! f1 k9 H{ # l+ t, e9 `. K! T+ Z" p' @
WScript.Echo("Could not load Model!"); 2 L- K2 z' `4 j# g/ I* i" O; E1 b
WScript.Quit();
3 i) w! |) ]& I" z- X} 7 c2 t( ^0 L9 M& c4 K! g- b
4 `2 `+ K6 `. v+ w& e& i' ctry 9 m2 N1 D" x/ j4 \: w* C
{ 4 f' j+ l# P' |5 S5 m1 H& K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: o2 n: W+ x& o: J/ d. W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- v. h/ |9 i1 Z! p$ F! m, G if (r == vbCancel)
! J) b* G) g% W1 `& ]' O, }# M7 B {
; i0 F b9 W8 @; Q% y: k3 C6 S' M simple.CloseModel();
% h. b0 \( t- R9 Z' J WScript.Quit(); . i2 z! L* v1 L! t
} + H/ k0 F" n, c
} ' R2 V8 n5 u2 t; G6 R
$ @ ?" k1 Q5 ?" j1 q9 x& e% b Jsimple.StartSimulation(".Models.Frame.EventController");
, t, @. {/ l _* u. V d
: V0 X6 t- k4 t0 K a) C* Nif (simple.IsSimulationRunning()) $ n( A. N! }' L/ o2 b/ N" f
WScript.Echo("Simulation is running!");
; P& |: \8 b9 F$ g9 c/ _; f
% K; n# g5 F+ ]7 _, h+ k9 g// Wait until simulation is finished
+ L1 [' n/ ~8 L M# {" |& bwhile (!Finished) WScript.Sleep(2000); % i% r) V5 C, ]$ }
7 p/ E4 d Z' P) {) J$ Nsimple.CloseModel();
/ ?6 A9 v( i4 _2 l- ]8 ssimple.Quit();
$ f& D5 o2 D+ d* D5 _WScript.Quit();
; M, i7 z; }, T& e3 o8 U 8 C( `- H3 k' m5 k. g/ x& B" v8 q& P
+ w% j; o5 o( e9 s4 h7 E
function RemoteControl_SimulationFinished()
! T( G# e6 n0 h0 I* Z{ 6 v+ e" r/ i: ]9 q
WScript.Echo("Simulation Finished!"); |