Example of a JScript 6 j. a! ?' m% A4 Q; t# c
var vbOKCancel = 1; # I5 `. {3 u/ q: [2 O
var vbCancel = 2;
8 G' \4 }' \% T3 x4 v% [6 Rvar vbInformation = 64;
1 L# S1 Y: a0 r4 N2 R$ S+ xvar Finished=false; ) Y- k1 f5 A0 e' v, Q# u% m
, i7 a6 o8 G% G" I( N ]/ V8 hvar WSHShell = new ActiveXObject("WScript.Shell");
, o7 S' l, z" T2 g
6 F- v1 d! t9 }3 P4 t2 _4 C- Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) d9 T& S. l" g* y5 d. ?' s1 u % c/ N6 ^; {; s4 X
simple.SetLicenseType("Runtime");
6 h$ D6 m: C+ ]5 o, f0 y
* @6 c: n0 t; Q0 k6 G( Ztry 8 H" e& h7 R' ^
{ 8 w; I# I' E `, e
// Enter the path to a model file!
) R) x4 p. q$ H6 O) e# C+ V- g; }: e simple.LoadModel("C:\\Models\\Test.spp"); ' _* d* `7 O) B* i/ R% P9 ~8 A
}
0 H% E) Q) W Y- ncatch (e) 0 \* D6 J" t) s4 o# _
{ ! A% {; d$ \/ u
WScript.Echo("Could not load Model!");
9 G. L" W3 B) _4 w5 |' c! ] WScript.Quit(); 3 X" r) V6 E9 ~6 f0 k- i
} . T+ Z7 I5 w2 N( l1 w7 x: |
' b* K' ]$ c- e- F
try 7 C$ J4 R% ?: P/ l4 Q8 U3 @
{
( W% B9 B9 }: ]2 O, x1 A# M: v simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , m& n& f; |9 E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( Q7 f8 V, }, H6 d2 Q
if (r == vbCancel)
$ p, b" l+ {6 l/ L' `4 W { f0 C; `6 W# S. X" [. s& x, B
simple.CloseModel(); ! K) L0 K- q6 v. n
WScript.Quit(); ! @7 n# [2 h% \. @# L( w
} % D4 d `; {; ~: L) C" L
} 1 Z* b( D$ I( B
c' Z' S/ b! m* w
simple.StartSimulation(".Models.Frame.EventController");
0 T4 F8 J, k2 s
" |7 g5 k8 Q. t p7 e, G, u" g; Iif (simple.IsSimulationRunning()) 6 B* D' b: o( G [8 Q
WScript.Echo("Simulation is running!"); $ h. `+ Z- W1 b4 X+ }
0 X% J) X- ]6 c3 X0 p// Wait until simulation is finished
) V3 B. m! g6 t0 T3 Q; t) b$ T+ owhile (!Finished) WScript.Sleep(2000);
: F3 B% |9 T' }! [0 n, ?6 ? % H" \3 c( ?+ | ^' w
simple.CloseModel(); 4 [* P' w2 h& _+ g0 k* ?8 [ E5 M
simple.Quit(); 4 G/ t4 }/ B. }! i* g! h1 Z
WScript.Quit(); 9 K3 L0 w. ~3 {7 k0 V7 _( O% @
9 o. S: d$ }- l4 B& ^
9 U1 Q# C( Y& j2 G, ?$ M* tfunction RemoteControl_SimulationFinished() & P) i9 _. v: q, t% Y6 S
{
+ I% a6 n4 a: t L& G2 U# F5 S WScript.Echo("Simulation Finished!"); |