Example of a JScript ! _2 S6 H( |1 N/ x$ }
var vbOKCancel = 1; * ]1 D. h- ~. U/ Y! X4 ?
var vbCancel = 2;
# I# F4 s. Z# I, t2 P1 Jvar vbInformation = 64; 5 f- R7 |8 u9 u4 d( h+ A/ \- F
var Finished=false; $ w$ [8 W' V. c/ F9 i e" L
4 S* t& b' s# J7 y2 D# o! T& Vvar WSHShell = new ActiveXObject("WScript.Shell"); 8 {+ h8 J9 q, Q, d7 W
9 Y/ r6 t8 Z0 F: Bvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 k6 P# g. y6 f& a
4 s: I& h7 f$ ^* b1 j$ W* Qsimple.SetLicenseType("Runtime");
2 e! E9 o" [0 q
0 @3 q$ O6 t1 s/ q7 U$ p, `try 2 e0 @+ x( g8 t9 {) c
{ ) J3 E; S6 C2 i: e- n' e
// Enter the path to a model file! 3 ~6 j" d t6 y- ` T
simple.LoadModel("C:\\Models\\Test.spp");
, g* n0 S4 R1 Z} , O8 |' o6 T8 B6 c" g# n/ q
catch (e) ) X: A1 [8 Q# k D. j; Z& H, [
{ ) o2 ?0 R3 M2 F1 @8 E+ N
WScript.Echo("Could not load Model!"); ; ~; j/ P( p: K6 H% F
WScript.Quit();
5 {9 T' S0 O% y+ e& S} , Z% S5 n- w7 F6 a" K& L
0 {- j; f4 R; Ztry ; y0 D! V5 u6 g" R6 K3 }. G
{ % Q. x2 s& z+ `$ a
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - E1 F$ p2 C6 `6 }! x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + Q; L; m O/ a. f% g8 s+ |; H
if (r == vbCancel) 1 b1 ]" k( K! Y4 o8 k- z! O
{
2 f f M) v( U+ B, \ simple.CloseModel();
, |. y* C1 P- {5 Q& C4 z1 Z WScript.Quit(); : }) _8 m h6 D$ R$ ~/ N
}
6 ?5 z4 A S' O2 E/ L9 w. ]}
3 @( I: n x6 @1 u7 e
) ~. \) t2 o( I c1 [. s1 h) jsimple.StartSimulation(".Models.Frame.EventController");
& ^! m" v) o& V1 W - V9 B, y3 W$ S$ J
if (simple.IsSimulationRunning()) % e2 T6 j9 [1 U6 k4 u
WScript.Echo("Simulation is running!");
0 Z4 o. Q7 u- u % N5 W4 A2 s- }- b' V
// Wait until simulation is finished
, ]- g/ D9 u; i5 P6 Ywhile (!Finished) WScript.Sleep(2000); ( @) h, q5 P1 r$ j# @% L
% j5 r4 T, f$ v9 S; N: c) W" `/ g: o
simple.CloseModel();
, Y! {# }$ c; \" Y( z3 N& Esimple.Quit();
6 q0 x' h' {3 g2 z- l# ZWScript.Quit(); * U: ^; ^2 g" F# d& a
1 F" z. C3 f0 h4 l, E& z) Z 5 D" P0 |) ^3 \! [1 d2 }( w
function RemoteControl_SimulationFinished() & B5 a4 S5 j* \- H" R
{
0 |& }1 E+ E: U" v: \$ | WScript.Echo("Simulation Finished!"); |