Example of a JScript
7 S/ f8 }3 a9 }, q2 @# ~var vbOKCancel = 1;
, U$ x1 G0 \6 Cvar vbCancel = 2;
+ f2 K0 {8 |) c8 T$ Zvar vbInformation = 64;
|% ?) F; c# z4 S; ~& Kvar Finished=false;
( r, x5 R9 J; }# G, Q, L- f1 }% m # \1 k) ]: ^' f( m8 q+ ~
var WSHShell = new ActiveXObject("WScript.Shell");
! ^! W, t+ }. G/ I" C 2 B* K8 F+ T9 s/ Z+ i/ x. i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 q% d- q/ g; ]; J. q$ \ . i& R! e5 d9 s
simple.SetLicenseType("Runtime"); / H8 I3 g& C0 H# h
+ M9 F8 D. w7 { I, z6 j+ v
try
0 Z# ~0 ?( b% ?( h: ?; E. B* v/ y{
" _) y9 f; R. P1 b3 N7 O // Enter the path to a model file!
# j, t8 V! B) w+ X simple.LoadModel("C:\\Models\\Test.spp");
7 Z9 n7 `- x- N3 o$ A; \} / H. Z8 A3 w9 t; w( O8 C3 W
catch (e) & P" v3 q6 O/ D" h
{
1 S& W2 Z/ Y2 B, s; K% b) I1 } WScript.Echo("Could not load Model!");
7 D9 x8 I; O8 Q: J WScript.Quit(); $ O; {& J, X0 p
}
; o+ t. k- _- A3 [- T6 r# a, a' x9 g
! S6 D' B4 l* Ptry
2 \/ w( S, h8 h, R{ ; f1 f( M& ?/ j: e" ~' q7 E+ A2 l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' o6 d: w6 Y; g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 V* ^! U' `$ [
if (r == vbCancel)
4 n% @% W2 e" J { + a+ b# o( |- n- n. \; I
simple.CloseModel(); 9 i: ~6 }) c, h9 W2 b
WScript.Quit();
: \9 N- @, k- @# v! B1 P3 x7 R+ J. x } - m' W6 z* x( A" K# }/ C
} ! h" g- X. ~4 O. e
* R3 u6 Z3 a. `0 S: ?simple.StartSimulation(".Models.Frame.EventController"); 0 g# B8 u- d6 L, n7 @/ [+ ~6 R1 i; g
/ h% Z) a1 W3 O6 F. @$ H4 n
if (simple.IsSimulationRunning())
6 H: M. {! a% n1 l! K WScript.Echo("Simulation is running!"); & E3 Z, b# B! d9 _2 \
+ V5 G- u# s' i- }1 N3 q' f8 x// Wait until simulation is finished 2 J# j, i$ \) G: |8 \9 V7 ?
while (!Finished) WScript.Sleep(2000);
% j- O6 M. p3 ]
~" R" z' t* K& }2 u% G% _. g' psimple.CloseModel(); o- i1 U# n4 R# @
simple.Quit(); + z1 u2 }, Q! I9 F6 p, K# C m
WScript.Quit(); + Q* n6 W& I, Y: ?( B% s
6 e* F5 H4 s# G; h. g/ m
$ d: H5 g+ @% ^8 D' X. Yfunction RemoteControl_SimulationFinished() 5 m: {' V% ?: i* d& b2 a! Q# y
{ # M. X, q$ O, g# A, K
WScript.Echo("Simulation Finished!"); |