Example of a JScript ) G/ N0 t9 U: F5 o8 Q4 g. W
var vbOKCancel = 1; ' \2 t1 c$ {+ E+ V
var vbCancel = 2; ( ]/ v" V( q3 |: l& r5 m% d
var vbInformation = 64;
, e! c- c n8 ]% F6 N Z/ I1 \var Finished=false; + f# Y$ o7 V. _: m6 |9 O
1 U& k1 s* B; ovar WSHShell = new ActiveXObject("WScript.Shell");
0 T/ i- I% Y r1 { 0 X2 C& r" t q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 `7 E4 _# G$ V3 E2 F( ~" P
. Y! E" _# U- T: ]% E3 qsimple.SetLicenseType("Runtime");
4 t, B" ^2 `. Z9 f! \" A
, Q! C' ]" r& a+ ]1 M2 ktry
4 a7 L, y) ?( l2 \1 A- ` A1 j{ % c- D( T8 E* r
// Enter the path to a model file! " T# g9 l, j/ g6 W J3 c
simple.LoadModel("C:\\Models\\Test.spp"); : d9 Z# [+ J: c( h* S4 u3 w
} R! @* r1 A- Y$ \9 q) \ g
catch (e)
- A7 \! M4 K( d" U3 K7 k6 _ R( F{ 8 C9 J7 ~# W# @! y! @8 S! D
WScript.Echo("Could not load Model!");
: _7 E8 p6 `1 l$ }2 ~, _ WScript.Quit(); / B L5 D4 y1 d1 q3 ~8 u4 }
} ! i7 l' {" w7 F" \$ C! A% C& Y4 Z
) L% M+ Y/ m# U5 L- F9 B; }' Jtry
/ @& i$ w" J) R6 L) f1 k{
. c' d( S4 u. b- z; ]* d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 G2 |" l N, E/ T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); z) h) S A2 s7 _, b; f* n; b
if (r == vbCancel)
& z- r0 _- E) g { 9 s9 O( N' X( A. [7 E8 |* w. ~6 G
simple.CloseModel();
- L m: S7 L$ \# ` WScript.Quit();
- z4 t8 M; W8 w' ` }
6 Y \ c2 q5 Y- o} ' Y, l/ i, v% M$ K
" [- B# i8 D. B" Ssimple.StartSimulation(".Models.Frame.EventController"); & k4 Y2 O, t5 g
7 _% [$ F0 {5 h- O% j. mif (simple.IsSimulationRunning())
2 ` A0 F1 m( C, n1 W# e WScript.Echo("Simulation is running!"); # c% W# M& U; l @, N
, h$ y9 a+ F7 Z1 K0 A0 m% O" `! G
// Wait until simulation is finished
+ B) ^. @' t" \8 Y- I( Hwhile (!Finished) WScript.Sleep(2000); ( V& e! u' D9 _5 Y% k! y4 p. B
, a+ N C8 d5 s$ t+ d
simple.CloseModel();
* M' d# N& \/ U5 L9 v) `# K' hsimple.Quit(); 2 i% R/ x3 j0 Z) ~* ^
WScript.Quit();
) t: p( J5 _& D
5 P- b# W8 C+ z7 F3 W. J
4 K" H5 {# p" e# L. A- S& Kfunction RemoteControl_SimulationFinished() , P) c3 [, \9 h
{ / D% i; c2 d F# P0 b5 ~: h3 X
WScript.Echo("Simulation Finished!"); |