Example of a JScript G' v& d) R+ w
var vbOKCancel = 1;
; a8 {( c @* W: T" C' w5 Dvar vbCancel = 2; # ^7 c: m. |) L5 e7 W u2 g
var vbInformation = 64;
M7 y$ y5 n$ l6 t& Hvar Finished=false;
+ S+ u! S5 @- T( k$ Z4 S8 d! [0 P- t
1 H/ O5 W: Y/ Z0 gvar WSHShell = new ActiveXObject("WScript.Shell");
% ?2 h9 j: ~ }
2 u, ~8 L7 X8 M, ~% Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - e7 s' T% q. i9 @3 Y* u
7 W6 }' {' l* c/ L: R0 U
simple.SetLicenseType("Runtime");
; H! ~) @' H( I/ w! L: J x+ Q / ~# R9 j! |! o( K H" N
try 6 m; f- R/ {8 ~! @" ?( q! a8 |2 P
{ 0 b1 X$ }- N- L
// Enter the path to a model file! Z! c8 P, w; G( x# F
simple.LoadModel("C:\\Models\\Test.spp"); 1 y9 _ o: M9 I( d( J4 t. K- |
}
9 F [( B# L5 \& ^, y+ R: a7 ?, ^# Z- Scatch (e) ( ~9 x; j, k8 q' @+ c: X5 T
{ 4 n2 ]+ p0 F! |) M2 p! z/ G
WScript.Echo("Could not load Model!");
6 ^! Y" u( Y1 ?* w `$ h& i WScript.Quit();
* _5 ^6 W, a9 w9 j% ]} # X, ~/ z! g4 @1 Q: m9 {$ f- X' H
% K, p/ @, G2 E4 N; Z+ z* W
try 7 N4 Z2 p% N5 d* z
{ n$ g. ?% P8 b8 R$ u1 q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. Q2 F6 x: B* V2 V% @ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 p) W: t7 d! h" f* P9 b0 v if (r == vbCancel)
( E& o W: s4 d9 c" Y4 x. p1 S' j& u { 8 i, Z- g* S2 W* q$ r" Z! l0 w! A
simple.CloseModel(); ]( L0 b: l' [% {( o' p3 ~) f
WScript.Quit(); : }7 s% B' I H1 p; A; n1 r" D
}
% Q; ?' K4 p0 W4 v" r( w; F} , W6 o. N8 k+ l/ b) W2 y5 ^+ |
- D; d! z, Y1 ?3 D- gsimple.StartSimulation(".Models.Frame.EventController"); 4 G2 r, e7 {1 I, G) h, |2 b" z! c
& O5 }* h/ l7 S" k# N9 R6 D
if (simple.IsSimulationRunning()) 6 z$ l+ h) W% A6 V* ^
WScript.Echo("Simulation is running!"); 1 s/ A( {% Q; x3 o- f7 f
0 |$ t. d' V& N. {
// Wait until simulation is finished ; \1 m" |0 f& w: _* s$ H" C. A- G
while (!Finished) WScript.Sleep(2000);
$ l! z/ x# a' F" E o , ~$ { O( D d9 e" V* D
simple.CloseModel(); ! B: B6 ]/ o' D9 D6 T# v) C
simple.Quit();
0 `- r7 E2 s/ o7 W& d- VWScript.Quit();
2 `7 O% ^* r9 Q1 F0 \ ' u3 h$ E1 T) y! n5 d7 ^
" p1 q* ?3 E. G: d" z7 Hfunction RemoteControl_SimulationFinished()
/ L% z+ A% `- f. f6 i3 s9 J' l9 L# H{ 1 T3 Q. V* d7 D/ P- ^- G2 h
WScript.Echo("Simulation Finished!"); |