Example of a JScript
, K7 { e. T9 I3 M5 m8 @4 v# }var vbOKCancel = 1; 6 v4 G2 g& ^9 @! J R. F
var vbCancel = 2;
3 m" f% |7 p5 b; k# p9 nvar vbInformation = 64;
' ~' ]+ L$ P: `2 {, i, ^var Finished=false; - }# z8 s$ y, G( |; ~' W$ L4 f
/ Q1 {" w L0 m4 e4 }5 R5 Bvar WSHShell = new ActiveXObject("WScript.Shell");
, q3 g* Y0 u: c C3 G
7 v2 F3 ~' K6 ^- Yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& \- p2 n4 w% Z, f4 s; K# S/ n
% L7 O& { ~! i& n, Osimple.SetLicenseType("Runtime");
. h& |- e5 a6 h# V) z6 i ( Y/ _$ K8 d4 a1 r( S5 L8 o1 t
try ( X) c" y8 w$ U1 O# S1 ?% W. g
{ \9 T# A8 A1 J8 p* [
// Enter the path to a model file!
" }( `) E$ y2 U9 d2 g9 z2 p simple.LoadModel("C:\\Models\\Test.spp");
7 M0 a: u; X3 } S7 |} ! h+ a4 |" U) F
catch (e) ) O" @' B5 G4 U7 Z M9 z
{ 8 J+ k J2 t; `+ m! a0 y2 ]9 v/ x7 N( c
WScript.Echo("Could not load Model!");
; c# A& C, A& @" G) K WScript.Quit();
+ W% I. b; m; }; |9 `. u, ^}
5 t' X9 |' ]6 h9 e5 ^3 @- i% N $ l/ r4 X$ r+ Y) w
try
& }* [% @" v% _" [{ , y2 Y% \0 _0 x2 [# q1 N
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( f1 I# T& ~0 [+ ]# U. K+ G. P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 E* S4 ~- {. {$ S9 P* Q
if (r == vbCancel) 9 R- V. y) M& K
{ % W0 f/ D& ]3 \# N y1 K6 k7 I+ o
simple.CloseModel();
* N0 x2 t9 S' }3 F3 X7 H, R$ A WScript.Quit();
. g5 c: O5 a% W4 s* Q }
- R( S% l- j$ o! q! f} 1 X6 W1 b( r% s/ t' \
I* y6 B/ q( p* c* D" L
simple.StartSimulation(".Models.Frame.EventController"); $ o, `4 z+ C4 ^+ D1 E/ `
9 z+ r" }( ~5 b6 J7 n: Q
if (simple.IsSimulationRunning()) / `6 m* Y& a9 P$ [4 g+ i6 N
WScript.Echo("Simulation is running!");
/ v; K2 |2 L# m y! K/ B
- P1 A) p4 B) t0 C* P7 U// Wait until simulation is finished 1 s9 ]) a- B6 f* a; t
while (!Finished) WScript.Sleep(2000); . P% _1 Q4 }5 M* F3 i( S' b
9 }. T; u$ B5 @3 g
simple.CloseModel();
" T" O& A7 u0 [4 n! k1 qsimple.Quit(); 6 `7 @$ H5 W" p0 q* W1 q
WScript.Quit(); 4 q1 [1 m2 ]% `- A8 I6 G
1 f% q. l; G! H+ ]* P, q; D , u6 e! |, _3 T# r4 ^
function RemoteControl_SimulationFinished() 0 H- R7 q" J' h4 M
{ % c/ M! B: \; Q7 T
WScript.Echo("Simulation Finished!"); |