Example of a JScript " T3 U ?2 o) j0 [% p- m9 `* s
var vbOKCancel = 1;
3 g: {) d+ I/ }7 m% N3 rvar vbCancel = 2; & V# M3 X4 \# N" g
var vbInformation = 64; \1 R* B j" l7 w; ?; a
var Finished=false;
g9 G+ n/ c) F1 { & _- A P: a; u& W! H. i! ]
var WSHShell = new ActiveXObject("WScript.Shell");
. Y/ o- z7 w7 }# P. n E $ f1 H4 O" S$ V4 w% r% i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- X r! ~) p! \
$ {% D6 l/ w. @5 x4 E8 G2 csimple.SetLicenseType("Runtime");
- V7 }, }7 q3 y- B4 D9 F 0 u o! p8 t2 c5 p2 P2 S
try ; i/ M7 O% |* _* E2 ]2 c& e) S. c
{ 7 w8 L1 s( e( y
// Enter the path to a model file! ( {! s. Z$ D- R9 \! S |" n! ]3 _
simple.LoadModel("C:\\Models\\Test.spp"); 6 n: p1 U% T) p n% j" g
} 8 {0 M2 u" V/ n& Q. |' K$ Y4 a
catch (e)
( l5 j7 P2 @. j/ v5 j0 j F{ 5 m/ ^6 ]/ n8 o* f8 K$ K; b7 c' d* \
WScript.Echo("Could not load Model!"); ) h1 \' I- g" U7 b( Z7 n, X
WScript.Quit(); 3 w" [. Y( A! G7 q5 z7 ^2 V
} 2 ?: o; d- P J
# Z9 u9 j ~6 itry
7 `: W4 M4 o) P9 `5 U. z{ - o! o9 C1 M9 R8 [+ t. m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ q: U, R$ M; o6 v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ o1 M) d+ t; ?3 U( ^( u if (r == vbCancel)
" \ y R3 G5 O" _+ t; w {
' i7 g% Z: c' D" d( q3 y simple.CloseModel(); 1 o% |8 O( }7 |$ W
WScript.Quit(); 7 ^1 Q. _% t4 H# k) P
}
3 N/ o2 W1 w' \9 \1 I8 T- f} * H9 Q& y9 b) y, o
$ w' C. E, W+ ?8 W! p- ?7 `simple.StartSimulation(".Models.Frame.EventController");
* G6 F1 U! D- y# X/ p) j/ ^9 N
/ h* P# g% a8 @! F; j9 |) K Iif (simple.IsSimulationRunning())
- T1 J/ Y7 O& h' L# Z WScript.Echo("Simulation is running!"); 2 R, v' |, _% X9 P3 x
" R/ I- v a# j/ N! f% E* K: ^// Wait until simulation is finished . _; {6 d2 q* e' ]0 Z L
while (!Finished) WScript.Sleep(2000);
- h; u& Q, O+ p- `! p 3 m, {( F/ L& c' _
simple.CloseModel(); ; E- T- b: r6 n1 j0 s
simple.Quit(); $ h* v( C( Q6 b1 ~- R
WScript.Quit();
$ U B( a, ^2 s. o" a
4 o! Q( I9 \+ s. C # b" C/ S- p7 \1 p/ L
function RemoteControl_SimulationFinished()
# G+ G; D' a3 t% _9 j# {9 ] h W{ , c3 n# X. J' R4 |% }& k" a3 D
WScript.Echo("Simulation Finished!"); |