Example of a JScript ) K1 g5 t5 y" T5 Q2 W
var vbOKCancel = 1;
/ b K% M7 l1 _. A( Qvar vbCancel = 2; ; M% }8 u- v9 w- \8 y
var vbInformation = 64;
7 W4 X F, O5 s1 L1 @/ X9 V& I4 jvar Finished=false; - d5 q' E3 l5 F+ q" a# S
% e5 b. [) C7 Nvar WSHShell = new ActiveXObject("WScript.Shell");
/ S* ]3 L# X) n9 t, @+ S0 r 4 V# h- W- {8 j0 @8 |- I N* W
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 F5 ]1 s* c" [: t% y- B& N 3 e w. ?; W7 o5 `7 v+ V/ q- M* h) M* \
simple.SetLicenseType("Runtime");
3 L( D0 J" [! M$ \ 8 F- L' K5 r" t1 P
try
1 ?# z0 Y, A/ D4 q7 ~5 w* ?{
2 F! B3 |) a) A6 S$ t# } // Enter the path to a model file! & W1 @( K5 g& L9 S- u/ s
simple.LoadModel("C:\\Models\\Test.spp");
3 n& q" v0 i, f5 B c* ]1 C" ?}
& T) o u! R1 C5 d7 J0 @catch (e)
8 W5 n9 X7 m y{
, G2 i$ \9 v& M7 H' q, T WScript.Echo("Could not load Model!");
3 ~- D8 ~& H0 |0 m z WScript.Quit();
' J0 C, r: p2 {- [) F( M) f+ Z( f2 H} % k8 L4 g( I: U8 D y i
1 V. j* I( }: Q$ I8 Btry 1 b; _1 t8 k! h1 X
{ / l- Y) k4 r4 t0 E0 [7 N: e" {
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; `* d b2 Q9 h1 D3 v8 M$ k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( m5 {# h* p/ x! z
if (r == vbCancel) / E6 U2 T' M; v7 r- z J* X8 k! c
{ 4 u8 N z J- c+ n
simple.CloseModel();
" `( y% T, ~ M4 I$ x2 \8 `' k3 K WScript.Quit(); 1 r2 Q+ {' [, f( e* t
} 0 Q5 [. ~* b3 r7 M/ j6 V
}
2 L$ b3 ?4 D5 U2 t* l; K! x
+ @4 `3 X4 S( Vsimple.StartSimulation(".Models.Frame.EventController");
1 G) \3 ]$ D) U
2 e1 [6 b1 g# G2 _if (simple.IsSimulationRunning()) , D6 L& T- b/ M3 i3 b3 H2 o4 d& b" t
WScript.Echo("Simulation is running!"); * U# w0 f+ z) x% R
/ V1 H7 _% t8 c) g// Wait until simulation is finished ; [% b/ D9 m6 P4 j9 ?9 \
while (!Finished) WScript.Sleep(2000);
4 |( [. D4 u; K0 \/ S1 v) b% B
" k% q0 d: v% I$ i3 O& {simple.CloseModel(); ( }9 G, I: V& r7 j) h m9 @
simple.Quit();
: ^3 X! p# Z2 U, W' iWScript.Quit();
' E1 t; p6 S( w + P8 J8 r) K4 G: x5 J- e
3 b- V5 L" i4 _function RemoteControl_SimulationFinished()
5 Z/ s5 ?8 E/ d: U, v{ P4 L" g* W8 J
WScript.Echo("Simulation Finished!"); |