Example of a JScript 9 p& }. \4 R. C7 H) b" e# F1 K
var vbOKCancel = 1; & f# l" X; K5 C) V* _8 T
var vbCancel = 2;
- M3 Z2 r" y( G# b( ]var vbInformation = 64; : a5 T: Z, w- a2 K1 q
var Finished=false; # Z3 t& U4 f. L/ ? g
# l1 _' b# \/ }' Q t3 g
var WSHShell = new ActiveXObject("WScript.Shell");
4 _ [ L$ _7 E. u; A ! S& L( B9 [8 t f e) E
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 ?/ N9 p i! M& [# G; c( n
. e; K- p; |, f/ T2 f1 R# p/ b* Dsimple.SetLicenseType("Runtime"); - Q& A: z% \; s
" P0 u0 K+ t6 @+ @' f& u* D b4 |
try
! t* V. w# f9 m5 f2 t{
9 p: P1 G2 O+ t2 A/ Q+ Y* x8 @ // Enter the path to a model file! 8 H, o% }5 R0 J; o
simple.LoadModel("C:\\Models\\Test.spp");
) l) x3 l+ X8 e" ~2 g3 h}
7 P; G( ?' P# d" `catch (e)
. ^6 k$ \9 R6 m{
& j" @8 ~# f) y3 _4 l& U WScript.Echo("Could not load Model!");
7 p7 @/ Z6 r, c; ` WScript.Quit(); x( {4 v+ @1 g6 L7 O7 ]
} ) W2 R* X, D, n: k& B
6 M1 T& f0 n! h* K. Q3 B/ gtry
- C" p$ i9 T- d4 K% d; z{ 8 E8 I* @1 @' ?' a: H+ f9 o9 ]/ v
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 V0 I3 `( z+ m( H, @1 G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 N: `! i: v* I+ | if (r == vbCancel) 6 S3 g. X% Q. P1 _* y5 \
{ % c+ _ s/ b0 m* A1 w
simple.CloseModel();
7 D; D7 x) g7 |1 X7 i WScript.Quit();
! u8 C- g! p1 e8 U0 s0 I- d } w3 d+ A8 L, `
} 9 P- W- j: ~2 @8 @3 L% x x9 d
( E, V6 U9 M% G4 u* ?, e
simple.StartSimulation(".Models.Frame.EventController");
/ w! O- Q! R2 o3 _
: e: q( N3 L f+ U i5 `if (simple.IsSimulationRunning())
7 p+ v3 h3 u8 D5 `: @+ g+ U WScript.Echo("Simulation is running!");
, n5 d _. z( O1 @( l & ^- i# q* u+ T3 x5 x* t. D
// Wait until simulation is finished 5 G& T; d& Q* P& o+ C
while (!Finished) WScript.Sleep(2000); ; N X2 g4 \! x5 I! c P
; G5 F: W3 u& w/ \
simple.CloseModel(); * |) f# b' y0 T4 v
simple.Quit(); ! R* t. o {; p. g; O) X2 V6 D; l
WScript.Quit(); - x( x& Q7 q7 I" Z# B
; w: k+ m- i; R
. d" q7 D- m# y( v% N; b- l# Efunction RemoteControl_SimulationFinished() + z0 [' S1 Z0 |. P8 H
{
0 N8 k( @, Y- g$ e1 w WScript.Echo("Simulation Finished!"); |