Example of a JScript 6 h' Z% W0 T' a2 j( h9 ]+ C: K
var vbOKCancel = 1; # }; Y& R; I; j( l+ O
var vbCancel = 2;
! b% i" f" P; T8 j9 y# f9 I. [; avar vbInformation = 64; 7 m* Z+ l, L# ]* S7 V
var Finished=false;
+ C. m! s! i" R$ \& I! O 4 y; W! p% @6 j! z
var WSHShell = new ActiveXObject("WScript.Shell");
+ G2 K) l1 O! }" A* ]% z8 a& h
' X1 T, s& o! q& q; |- D$ lvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) D1 w+ \8 o$ x4 E' [/ E
6 c- q1 l$ o( x5 [8 ]simple.SetLicenseType("Runtime");
9 w# _; P0 e) _+ s 7 f1 n$ c; E: H) B2 @
try 2 ]/ L$ j/ ~0 g4 p; j5 l% B; b
{ ' s' I. r6 E( x" \! `
// Enter the path to a model file!
. C; F }" V# [" n: z& G simple.LoadModel("C:\\Models\\Test.spp");
! `8 I `0 x$ P4 A} 7 B! |+ ^7 w; A
catch (e)
- Y: o, y0 h T8 h6 p{
- l8 {, ?( S& Q0 T+ T; m WScript.Echo("Could not load Model!");
1 k: x* F; a1 H& k7 H( _" R WScript.Quit();
' u9 x5 E0 P! r# u7 H* G} 7 v& `9 V v: q
; O. |4 n0 s: p4 s: j
try v W) C ^ f' z% R7 _
{ ; n4 f+ \! r3 R. v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: v0 D( C3 I" F+ l% G+ F, e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) x/ r. `5 { L& {8 C
if (r == vbCancel)
0 e. m8 d+ g, h. y$ |. Q {
y/ @5 H: u2 E5 F4 b( H1 X simple.CloseModel();
1 p5 l4 ]' P, o# @9 s: o& B WScript.Quit();
1 [" g" B0 e" T+ R } & D: j4 n; d& A0 v
} * T% M# P3 v) V3 M
' R1 z+ i C9 s" i
simple.StartSimulation(".Models.Frame.EventController"); + A: q; \! m4 J' V; Z% b# j: k* g
/ ?! W# n: T+ B9 Q6 A' mif (simple.IsSimulationRunning()) 6 `# f/ J* n0 |8 L2 B( G$ r- G
WScript.Echo("Simulation is running!");
- N* ]' u5 W, B! W& n
$ b) p1 \9 d$ G2 b# p; o* E( r// Wait until simulation is finished
' i& o/ D9 v. U% I. ]8 u Vwhile (!Finished) WScript.Sleep(2000);
$ @, O7 |4 y5 M # w2 a! d. w: K$ t% K8 O
simple.CloseModel();
6 ]6 ~0 P1 z7 |! W0 v0 F5 Csimple.Quit(); & @% M/ \; [6 w1 P" E
WScript.Quit();
- v+ I4 y: u7 J" F, j : {7 N8 @( ]& Z9 V% e
( g% p' ~- q; N2 e$ a& ifunction RemoteControl_SimulationFinished()
# w: `) t$ U: D4 i* I{ * d, E( l$ X2 A& S
WScript.Echo("Simulation Finished!"); |