Example of a JScript
3 G3 y& j4 g, ]var vbOKCancel = 1;
7 E5 G/ x/ N1 s0 C' Vvar vbCancel = 2; . B# \8 q9 b! _/ \! j' v, ?' V
var vbInformation = 64; B9 Q6 U6 w4 j4 z
var Finished=false;
+ F" \& p0 f+ F* x/ U" w - y5 J8 r1 [- y$ q3 q" `2 C' H$ T
var WSHShell = new ActiveXObject("WScript.Shell");
4 @ N2 p0 v0 I* i" E0 Q( N! w3 b: @ ' [" w* ~( d1 f2 n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
5 C* |6 X5 [7 R3 M! y7 n3 P, M- Q! l ) k2 _; G' `2 }/ y# Q# L( l! S) }" p7 F
simple.SetLicenseType("Runtime"); " ~8 e: q2 m a/ V0 r
P y7 k$ V( w$ x% S' U
try
6 j8 N. A3 [, |( s$ V{
: J4 n- h; W/ C1 f; h // Enter the path to a model file! ) ?9 C' P0 \% A0 E* s. P! ]
simple.LoadModel("C:\\Models\\Test.spp"); 6 D" \& M9 N8 E4 E' ]* y! q
} 6 C3 s6 g N' z- m1 ?/ m
catch (e) ( W+ o9 o2 a7 s- l' E7 G
{ 0 [; ` h5 g. h( g2 N
WScript.Echo("Could not load Model!"); 2 t' q; S/ X, W' Y- q% @( ], v
WScript.Quit();
8 l8 q9 J0 y9 d} - \6 g) |* r- F Q
% r9 c8 c3 |4 [ d& D! ]try 5 _# s0 x: n4 [9 l6 ]. J
{
; v2 Q- A" M* V/ {" b T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ ?3 I# X$ ~3 M& H" ]0 E2 v
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " u2 g7 W: y3 Z: r/ K0 `8 l4 B
if (r == vbCancel)
3 g( g" a' R, b+ e I { 9 u- F6 E$ u& b, W3 B( n
simple.CloseModel(); 7 g8 b1 e1 n+ H- m$ s) L
WScript.Quit(); h1 w. n: W3 \- ?$ n) M
}
8 n# r" c$ b1 k, h3 k q} ; q2 q Z( y7 F s, H: W4 I% @0 k/ b
- ^% S5 H# d% K( \
simple.StartSimulation(".Models.Frame.EventController");
, c. [7 w8 q) H3 a4 ] 5 u# e% f Z5 v& i& h' s! c+ @
if (simple.IsSimulationRunning())
- \! u9 u2 n: s; O$ {' [7 ~ WScript.Echo("Simulation is running!"); 0 K- D3 ]" J { ?
" F7 L1 ~- O- G) J4 Z
// Wait until simulation is finished
, y" P; {& U W) \* K, kwhile (!Finished) WScript.Sleep(2000); 1 E2 b* i" x0 I( M- l
. h5 a! y v( j
simple.CloseModel(); * I7 t' G: j! C8 w
simple.Quit();
' f. X. Z, l) b; a- p6 m+ \9 B. J$ \WScript.Quit();
3 F) ^$ r( E) m$ e& c6 N , s% y) j" ^; i0 r( q* Q& b# S
2 S. N3 ~0 O+ @; d- y) X8 Z# B* b0 mfunction RemoteControl_SimulationFinished() # K$ a2 N; x' t2 y6 e. ?
{ j" m p9 w- ~3 {- M
WScript.Echo("Simulation Finished!"); |