Example of a JScript
- }9 W4 o2 F! C2 f- H1 a4 d) pvar vbOKCancel = 1; ' N3 k" v( M A& @0 o( O$ C
var vbCancel = 2;
9 F( q5 A% k* T' Q6 I8 C: U Kvar vbInformation = 64;
. h. U, p5 z& i* u' Qvar Finished=false;
) }- e: P1 E1 j) y! g( h
% Q0 i" f/ P& C- u1 rvar WSHShell = new ActiveXObject("WScript.Shell");
9 l: q M# t: |! A
% w& N. V5 D& \- o7 e avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 @ f! W! ?' D# {0 y
' N% x" U l+ L, w; }4 e. O5 Ksimple.SetLicenseType("Runtime"); # W; ?8 u! \7 @' S5 e" h) ?) |( B$ R' V
; D& U; }/ h4 O* t$ l3 u) H- j
try ( q9 Y, ^1 i* `0 N6 X
{ . K4 w7 p. ~2 b5 W, Q
// Enter the path to a model file! 8 B2 N0 c2 I0 i5 N) t |
simple.LoadModel("C:\\Models\\Test.spp"); * v: i2 H/ _2 y% U/ s
}
2 _# v0 n5 t6 Fcatch (e) : ^, f" |. x' ]0 k; }+ G
{ & t Q, k: f2 G/ U# a
WScript.Echo("Could not load Model!"); 1 R. f6 U$ Z$ b3 C
WScript.Quit();
* e$ A2 A) O, W( f7 q4 h}
, o8 H1 ^* Q( x. p7 v) e5 D + h0 B* O* c% h4 n0 ?8 V
try 9 ]5 J) J* m: F$ V7 D+ {
{ " G+ h; J$ C% i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 i! h8 W$ n9 @5 J+ B* Q6 q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: \8 |2 I0 p0 L6 u- y+ l' @: H if (r == vbCancel)
, n. M7 d" A' k; U& f; M- n. Q3 @ {
& v9 V" ~5 Y+ q) @* g! [' t! r% `' n# \ simple.CloseModel();
4 F) ]2 c* Q, j7 F/ A5 U WScript.Quit();
. ^# g/ J# o2 p2 y0 ^" G }
: S! \. N) C. M7 ?( s# l}
/ y, v2 |0 g# J / u, ^. o& ]4 ~; |" L1 U
simple.StartSimulation(".Models.Frame.EventController"); S; u! r% V# S: L* ]- g
1 N4 P1 h4 D0 \# o0 f0 F
if (simple.IsSimulationRunning()) ! W' h( `# |, e- b e# e
WScript.Echo("Simulation is running!"); 3 C5 { X' g G. Q o# r: K! X
! o( Q% w; X! ?// Wait until simulation is finished ^! s4 |: F/ G' ?9 b8 g: _' ?
while (!Finished) WScript.Sleep(2000);
; o+ J3 }0 o" j& |& l, R, F( t
8 j' j! f8 f1 j# p9 u- gsimple.CloseModel(); 0 S4 x) K: g/ B3 J$ l
simple.Quit();
: K4 @8 [! V. X1 ^& m3 WWScript.Quit();
0 H7 h: L! u! B0 p/ ?' @9 `/ D' W2 o
: z' A- H$ B2 s7 @$ ~5 v
% F1 p! T+ T! n4 J f0 @# L4 \: V; cfunction RemoteControl_SimulationFinished() , _( e1 z5 \. D& j
{ / i7 I6 z* D' Q" t& e
WScript.Echo("Simulation Finished!"); |