Example of a JScript % c4 O+ f2 I9 Y) s6 c1 o4 X
var vbOKCancel = 1; ( E# _* T2 I' R7 t* a
var vbCancel = 2;
: @4 i8 s# W& V: e# _9 K7 y% avar vbInformation = 64;
2 s; y# [" l: S) c! fvar Finished=false; 3 f" [8 g! u9 y/ r
- @* P0 ~/ v( K w1 ?9 u: [2 j
var WSHShell = new ActiveXObject("WScript.Shell"); 7 N. j% H- A: N8 |/ u8 M1 m4 V- D4 Q
. l% |3 x/ v" V9 ` Q, n7 ?0 k% l
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 ~) Z- q7 l9 i) D$ g; V
! m5 M# T! i0 E6 e4 T
simple.SetLicenseType("Runtime"); ! t2 e0 d+ s( K2 ?2 q
9 |9 x! G" Y4 f- F7 {" P s! stry
# f/ K1 y5 l8 z{ + I4 D, B& ]% w6 F) `
// Enter the path to a model file! # \0 s) r2 j) n! E$ c; G! W1 g
simple.LoadModel("C:\\Models\\Test.spp"); " ?* r1 T+ G! [' i
} - U4 y+ q- Y2 N. ~4 n0 v& y$ a
catch (e)
! i3 m6 O9 p, r) G3 T6 ?{
' f& \+ q: e, Y# } WScript.Echo("Could not load Model!");
& E: I) ~ U8 H8 ~ WScript.Quit(); # R0 D7 T# n* L3 T
}
/ ^2 X% A+ K$ U0 Z o' Z 6 [+ o' Z+ r. P! [# A3 E9 Q& J
try
( K$ R0 }2 i( y& X, N! l1 f6 R{ ' L& Z8 }. ]; ?) j5 [7 Y: b" d7 s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 W9 g) W6 N8 s# g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; a# o9 A5 a$ {' d' j if (r == vbCancel) & S5 Q- u" F4 V; B* A) }$ T& E
{ ; S0 u6 b5 D- Y b# s- C
simple.CloseModel(); & ?4 f+ {1 B+ b1 C# y
WScript.Quit(); 8 U; a/ J* G8 P- P
}
2 h) H, \$ H4 U0 o& Z} 6 y0 L" x( D1 _- I; F
- R8 H m* L. V2 U$ Q" _- rsimple.StartSimulation(".Models.Frame.EventController");
0 O+ J8 r7 h8 \9 A0 Z 7 i8 ?! t+ B5 y3 A
if (simple.IsSimulationRunning()) - D2 g- W _0 M# ?7 _
WScript.Echo("Simulation is running!");
d# T+ `# l3 d1 a. U
; }9 y9 w0 h: N6 \; _) I2 Z# B/ w// Wait until simulation is finished
5 `0 z; H7 X( Xwhile (!Finished) WScript.Sleep(2000);
0 C3 x+ D* M7 K+ f; w; w& n0 _5 }7 i" q % `& N6 B/ e \) d4 o7 Z) T' |3 v) V
simple.CloseModel();
% ^6 n6 x8 ]/ b9 Esimple.Quit();
( N2 \% v+ h) j$ ?WScript.Quit(); & Z# k4 h8 _4 G; k+ X/ I4 R" d5 r
; i& ~" ?1 t7 |$ n1 u 0 C8 L0 W! Q" ~+ x; `) ^2 `
function RemoteControl_SimulationFinished()
/ P$ m7 n3 E2 G{ 0 d3 p% _7 Q' t* K+ R
WScript.Echo("Simulation Finished!"); |