Example of a JScript
0 {7 I$ W0 r4 \# |var vbOKCancel = 1; Q, ~# N8 h- i B+ ^9 o. ]
var vbCancel = 2; 3 g. ?/ k$ L! o2 c! V
var vbInformation = 64; ' R2 y) d& T- N7 t+ z' ]
var Finished=false; 4 q1 u6 Q6 |( P/ m+ x
1 V" V, W. ^- X% i8 T
var WSHShell = new ActiveXObject("WScript.Shell"); ( X8 b# x9 `% ~" _( Z2 r; s
2 P! K# a; v U1 A5 Avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ o. e# u; q \$ W5 \ ' L( d+ [; D" |
simple.SetLicenseType("Runtime"); * b/ L4 f7 a h: `
1 L6 ^1 c: {" H) {: Y) R
try 2 L4 @" X3 I1 s* S; ~1 [3 V: R7 q
{ & C9 {; m, O j& w, T" c, f# r
// Enter the path to a model file!
2 X5 L- C! c; i: ~# [ simple.LoadModel("C:\\Models\\Test.spp"); . v8 \2 ~0 P/ ?9 ]& C( D
} 2 }3 R. w8 f1 d+ C
catch (e) 1 V0 @7 l8 y& c" |" }/ ~
{ . O6 P) ]4 Q- P; f, w4 d& M
WScript.Echo("Could not load Model!");
6 e2 V; D1 H& [! ~4 g- l/ p! F WScript.Quit();
9 D/ P! P( [ K' r; k9 X} ; Y* @4 c! ~9 R: n# l1 o
$ i0 m* t( q7 p$ `. Ztry A; C6 Z7 c" v8 M/ t+ b- W5 o
{ + _" ^0 g( Z8 ?1 E8 n2 _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ a0 E- X3 h' d0 E% N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: e6 z8 w/ e- |( ~* s3 B" j& } if (r == vbCancel) X/ u- J# b. H+ E. S
{ - z+ V6 G+ h4 I+ H- r" M6 g) q M W9 \
simple.CloseModel();
' @, j/ e& R' H, n% O WScript.Quit();
Z, @1 Q' A" I6 _5 [ }
* n% K& s* Q8 i8 u} + K9 R# h# d5 i. l
: G% z$ {5 X1 y/ m! h
simple.StartSimulation(".Models.Frame.EventController");
2 ?3 e/ V7 z+ l# N) C% U. h 5 k1 K# o: C) C/ M0 V" C
if (simple.IsSimulationRunning()) 3 k( t5 Z3 V+ n' o
WScript.Echo("Simulation is running!");
; Q0 h) P( `! X; U4 Q T
4 _* F3 S$ D( j- z0 T0 s# u7 v// Wait until simulation is finished # m7 c* b9 D9 a) h' N! ~, |, L) g0 \
while (!Finished) WScript.Sleep(2000); 4 b8 k1 H8 o7 ]9 F
) Q. r3 Z; W5 L9 O6 P5 z0 Hsimple.CloseModel(); / A) C! m8 g$ b, o% u* d0 i
simple.Quit(); . d+ M, a3 L8 f9 h# b( D5 s' W1 N: r
WScript.Quit();
* ^2 x1 S" Q ~6 }
9 p% m5 D1 P" I7 h8 n* z9 B
* B* T! d% J7 z1 A2 r. n n5 ?function RemoteControl_SimulationFinished() ) f# u0 j0 i: f3 _0 p
{ & A+ b# ?: K# x7 u
WScript.Echo("Simulation Finished!"); |