Example of a JScript
. v+ }# y' l5 }" @& K4 w$ `var vbOKCancel = 1; $ [9 N3 V/ S, O9 B" M3 Y7 E# q
var vbCancel = 2;
! m, o: K. `. w* a) pvar vbInformation = 64; * O0 l. m+ z' `- J$ u% B) a9 J
var Finished=false; # |3 n U& ~& L
- H; [3 z5 S, P3 {# L! Wvar WSHShell = new ActiveXObject("WScript.Shell"); 0 r/ u4 X. x- b% a
1 f0 g6 e& p @# `/ V; \+ X
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 b5 ~" y: M- R' ]5 M# Q
" P1 @! P' B0 X+ Q6 Fsimple.SetLicenseType("Runtime"); & y$ i$ l) d! Z4 {3 o+ b' M
" x( Y7 Y, l" ^/ q/ x: l: F* v( Stry ' V6 r6 o" _: q: D
{
0 A# T# }+ `; B2 G // Enter the path to a model file! 9 W- e1 j! h! o* w; o% Z; ]. m& ]
simple.LoadModel("C:\\Models\\Test.spp");
$ E$ }' M8 ~ J4 k$ C} 3 u+ w5 i' Z4 H6 P/ M7 j8 Z0 P
catch (e) . e' T' D6 t6 A& y5 n4 ]- a* `* g; C
{ I6 a7 g! W+ v4 P. G5 M4 g
WScript.Echo("Could not load Model!");
1 D8 H; J5 l7 s! }3 G/ ` WScript.Quit();
0 t# Q7 H$ g0 n}
: E; y1 w, l3 h( _0 _! u
& A: ^* W# }" r6 `8 i8 u. r0 o1 xtry + f4 p: y! P. t* n% e' ]
{
# Y( U* Q1 I1 D! p! m2 y3 l1 u simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# O4 u. j; _& J- W1 \ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & G N1 l0 y5 |5 `
if (r == vbCancel)
6 U% R* H8 P$ A5 B { \+ ?, ]) l/ _6 }
simple.CloseModel();
& Z) m8 \8 n9 h5 ?" c WScript.Quit();
& X( K( _0 X ^7 J% s) S! n& m } |. f I: s. J( N% y
} 9 k- G9 g9 N/ }4 }/ \9 A6 B
! N0 I) q( m) f/ C+ Qsimple.StartSimulation(".Models.Frame.EventController"); ; n& s9 @4 i: ^+ @/ [& A
: u9 m3 [) v7 @3 B
if (simple.IsSimulationRunning()) 0 E7 C6 m* o: T3 m* R7 d
WScript.Echo("Simulation is running!");
5 r4 Y0 }7 F& I1 H9 A, C1 i' K
6 Z- ?; d! E8 K# C// Wait until simulation is finished S2 \1 t l3 z! K
while (!Finished) WScript.Sleep(2000); * h" h8 z# {+ Q3 S, y* @2 d
6 b- h0 F% C1 c% msimple.CloseModel();
2 Q+ j2 y! N1 `! y9 g" ], csimple.Quit();
' H& ~/ G( `6 ^5 b; n8 l5 aWScript.Quit();
; R; I* e9 b+ n8 j
+ @- ~/ m! k2 i/ W
+ y2 P; J& g/ Y0 m+ C: \/ a' x1 e; Xfunction RemoteControl_SimulationFinished()
' k7 v7 _( b1 ?. v{ $ ?3 F5 c0 r5 F- r" d
WScript.Echo("Simulation Finished!"); |