Example of a JScript 3 h& E) k& k, a3 U$ [! U% c3 @
var vbOKCancel = 1; + W d/ a+ L( A ]8 J8 {: c* S
var vbCancel = 2; 5 e+ r" z* m8 J0 Q( B4 m
var vbInformation = 64; / P! b6 }" ?, U% E% _
var Finished=false; . s/ ]. F: @ B) F R( s
, G# e9 P+ B" r3 q
var WSHShell = new ActiveXObject("WScript.Shell"); 8 o) p. m4 x% O4 K
/ R: C V; J$ |: S% O9 I0 j7 _5 m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); Z% b0 K0 M* C* X7 p0 Z( b7 Q: K4 z
- Z2 D- I" T- V c# S
simple.SetLicenseType("Runtime");
9 X6 J1 r9 q& c 1 m' G5 s% ~# r- ~, Y
try
7 W: I0 I( F8 G6 i- A! S{
$ U* s; i+ c$ M6 O3 S2 {: r // Enter the path to a model file! 0 a: `6 \0 b9 E5 y
simple.LoadModel("C:\\Models\\Test.spp");
% n- F4 i0 [" e3 j, q} 9 }$ y5 o9 N- Y& K: D
catch (e)
5 k( Q- t' ~# S1 N: N{
' k4 O% S8 Z3 _& C7 v) P$ u WScript.Echo("Could not load Model!"); # e U4 s; F- `" ^9 a- F
WScript.Quit();
p0 F# {* u+ y2 k4 y8 _3 {} , }* x' _. l3 w! z5 R b7 ?5 i
+ [1 i* i* Q. s+ \/ M$ O; [! u4 y: T" m
try
4 n: t; p# Z- s0 ^- i5 |{ ( _0 N, Y3 ^" n" ]8 s% f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 F: g5 j! W% }) y7 v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& |: N3 p1 `$ ~+ f& E- z& b, _ if (r == vbCancel)
9 \" ?2 O1 h0 i6 A; ~3 y& p {
. b/ i- h2 B% l3 z simple.CloseModel(); ?+ u2 Y; M) j! j4 n }
WScript.Quit(); ! b* n' C* |5 D3 [2 E
}
$ e9 g" e8 c" v+ R}
# V. L( H* O6 ]" E6 q+ B! C/ C- d
' z1 \- n- c2 k" K% Y: ssimple.StartSimulation(".Models.Frame.EventController"); ; B# s2 a7 b& v( R
! m. W a1 i) j: f' t) A
if (simple.IsSimulationRunning())
1 u( [ j5 e2 C+ i! a# u WScript.Echo("Simulation is running!"); . @ b7 Y% U2 I* c
( {0 d5 C; B7 D// Wait until simulation is finished
7 L8 g; j( Y6 ^# g- A) w9 S5 Wwhile (!Finished) WScript.Sleep(2000);
/ G" U; T& T2 c# B3 d, g
/ U1 \/ H- Y9 e |% l9 T+ w, Bsimple.CloseModel(); $ U2 D% D( S: ]! V9 B4 X
simple.Quit();
- x8 r# j2 r. o, Y2 S. z5 uWScript.Quit();
" X6 {6 u% ?0 }5 a
( i9 a3 \& p' c1 W# g, v ! H; u, Q- C' x
function RemoteControl_SimulationFinished()
3 X" ~) W; S+ T; K{ 3 t% \7 i+ N; K3 X4 z& r
WScript.Echo("Simulation Finished!"); |