Example of a JScript # U6 i l3 x7 n, M4 u5 M7 P
var vbOKCancel = 1;
$ W; C& z5 x* Vvar vbCancel = 2;
' K* |9 T9 C, T7 k5 ?% N0 |var vbInformation = 64;
( n1 b; d7 p" }, X7 ~0 c" wvar Finished=false; 5 z! v# A" e& V( m! g& S: x
* o) i) W% g, X& p- _var WSHShell = new ActiveXObject("WScript.Shell"); 4 g, J0 a/ S4 Y' e# }
* [1 c/ c% ?8 N! t% ~! U9 Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : U/ z$ i9 u, a& M7 q7 ]
) ^' R! i/ h8 ~ d' D6 Q
simple.SetLicenseType("Runtime"); # J( M% g' q' Q- H9 o
7 `6 F+ t: }4 `: G# L% G5 c
try
( x& e' f. t# T5 Q/ u{ 3 ]* Z7 _: ~: H$ A
// Enter the path to a model file!
! o7 u; I8 A8 S8 F& d simple.LoadModel("C:\\Models\\Test.spp");
; ?4 `& Y6 A0 w+ j9 M! Q* ~} 2 [, e' R+ Q# {" I6 W: ^
catch (e) & Q. K9 i5 r- ~9 W8 G. W9 k: u
{ . J$ Q1 q6 q, d
WScript.Echo("Could not load Model!"); " ^2 E7 a8 m3 h; e' p
WScript.Quit(); 5 ~* A ?) J5 R- S! e! X. J
} * X3 [+ e: N9 M( W& |) e* H# g
$ k, _1 R9 N7 H7 i u# J
try
( u% A6 c$ D: P& Z: Z: ~* ?4 [- @{ : {7 M2 \; O- V2 d0 o1 n0 @" N% Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 e$ p: [9 t4 o0 U7 G0 o! S+ C) ~; w) D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! o/ {: F% f8 w7 F' y if (r == vbCancel)
; t( G/ g7 G5 K {
5 v* @, e% F7 Y simple.CloseModel(); & d+ f; {" o, }
WScript.Quit();
9 T2 r" F Y2 n2 G: S) d } ' S" ]! _& T Y+ _) X$ X! V
}
- Y; r6 O: p8 P
: D5 x" ^6 L& }simple.StartSimulation(".Models.Frame.EventController");
4 h+ @# m+ r6 s, B. B" Q" n3 I
( e' ~+ U' D& L `7 j9 A( lif (simple.IsSimulationRunning()) 2 x' `1 _/ f# G" s8 V# }- X% N) }3 L" `
WScript.Echo("Simulation is running!"); 5 R1 U7 h3 k: R8 W4 H0 X" l! U7 j. c
, G( f& h5 B' @
// Wait until simulation is finished }4 q3 h& ^1 I/ U' j5 m: P
while (!Finished) WScript.Sleep(2000); - {4 w% j5 w. V1 T) p; \- {
( D: `) @6 @8 d- K) w
simple.CloseModel();
; |8 W: ^" u9 a1 e& ?7 u. e0 q5 q6 V) Msimple.Quit(); 6 e% e% N& a# N) d4 c
WScript.Quit();
) k& @( y1 h7 ?9 y- y7 T6 U & j1 Z3 [0 l% |( [* W
+ A. x" D' i( a
function RemoteControl_SimulationFinished() 1 R. K7 B6 B) B" V' F$ a: `
{ ( H2 b+ Z8 W; I* m
WScript.Echo("Simulation Finished!"); |