Example of a JScript
+ Z) G6 q% i& [& ]* P8 e3 ]# ovar vbOKCancel = 1;
- K/ K1 G. n- i. Lvar vbCancel = 2;
1 _' F% C% t( C. J* q" r2 `6 v: C4 jvar vbInformation = 64; c8 o( z9 o4 P" Q9 f
var Finished=false; * h, s' f4 r. P5 b* @
) w2 I0 w/ [# a) Q$ z( r( F8 u
var WSHShell = new ActiveXObject("WScript.Shell");
) r: }; c4 O' D0 l$ p8 |9 a/ Y
) @# p) D" N. E$ A V Mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + {( a, ~) J; a* A7 t
C4 D* ]0 r( E) j- h7 x3 xsimple.SetLicenseType("Runtime");
F; k3 _$ F0 f2 a% W" X 8 T2 \* u$ G4 n% R N' l
try
8 @# e9 g# l# y+ Z4 m{ " v# e; n3 ^ M) p4 o, T5 O1 c
// Enter the path to a model file! R! R5 U1 F. Y- ^8 O: w4 j
simple.LoadModel("C:\\Models\\Test.spp");
* q9 ?: O% b7 p) F6 x! H) x}
/ |, a% S# p" A% i8 Gcatch (e)
9 j" l J8 H8 o3 j1 `0 P. T{
# s9 T: \/ ]. g WScript.Echo("Could not load Model!"); " F9 Y- @% n$ e+ A! @2 X
WScript.Quit(); , n0 h) p" [0 R) [: o
}
& L$ D$ y N, O2 H) h" S 0 K0 G, N: U* d; D3 g5 C
try * o0 l5 H" D4 G% Q& U
{
A8 l" W0 r4 L3 h4 j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 o6 \1 B! h3 k/ b; y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; r; N9 a- q4 H) j) t
if (r == vbCancel)
# r+ W0 ?- N( p q! J% U# B {
0 t$ x3 c+ C7 m& `) K simple.CloseModel(); 1 B. ~/ D1 c/ e- l2 V& Z, V
WScript.Quit(); ( r$ [# \/ c3 u& ?# A$ }3 T
}
8 n6 e, ]6 z$ Z. L+ i}
$ X1 A# g( u" ?' G
6 n6 ^( f" V8 y& W$ z/ X8 psimple.StartSimulation(".Models.Frame.EventController"); 9 A7 I, A7 o5 M/ P1 ?8 N! _
' ?$ T: \1 O4 q6 g9 I# X" ]1 mif (simple.IsSimulationRunning()) ) b2 W$ d" ]; D. `. {9 M
WScript.Echo("Simulation is running!");
# V# I1 V2 F& ]0 v' D5 O. E0 u i( N1 k# _9 V1 g! {5 j
// Wait until simulation is finished
3 d8 z0 b- _ X/ f9 j) {8 s t3 `& F* ^; Cwhile (!Finished) WScript.Sleep(2000); + W4 U2 O0 W9 y9 W
0 [6 z6 \8 X+ q) {simple.CloseModel(); * T! d% M! |$ P6 S; z2 H
simple.Quit(); ' m/ D" L9 J3 v6 W0 g! R
WScript.Quit(); 6 H: R! Q& Y2 s
( d' \0 v9 z' s0 D, P( F$ S8 \
3 \" `7 d$ z @: rfunction RemoteControl_SimulationFinished() 3 G) ]- @" R3 G; P% T9 S0 j; D, S r
{ . m# Y& ^" K9 W" K: Y# |
WScript.Echo("Simulation Finished!"); |