Example of a JScript ' _! O2 R4 B. ^) }* j
var vbOKCancel = 1;
' C X( x& C+ Q$ z7 p4 V$ ?var vbCancel = 2; 1 A7 I" Q# P( R( B7 z6 @6 J
var vbInformation = 64; , [; s7 ~ |1 }: ? t" v
var Finished=false;
: ]+ N- A& I( J6 V + D! H. K; p z
var WSHShell = new ActiveXObject("WScript.Shell"); 6 m; r2 L$ s+ c2 r% H
0 z' [( N/ p# W) Z! V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 r' \+ |. f7 o- t
: A# \+ [9 G7 a' ^- o2 R5 C1 T
simple.SetLicenseType("Runtime"); 6 D \- v H2 ?6 D3 O3 P2 O3 [$ N
7 D* p, O, A( w% \# I
try - K/ m% w2 o, ^+ g( H1 d8 `
{ 5 [- u* S, x' x2 [ w
// Enter the path to a model file! * Z6 v! S6 L r; Q* `( i* r
simple.LoadModel("C:\\Models\\Test.spp"); " i# g8 f/ E! ?
} - g; T! i( A6 ]4 `
catch (e)
1 Y3 Y4 b. q: z; D; y{
/ j8 A9 A/ p0 i2 J6 c6 N% [ WScript.Echo("Could not load Model!");
% w9 X/ i% `: P0 |# C$ o i8 s' } WScript.Quit(); ! i" l4 w0 ?1 b/ ]+ q5 E2 x7 q0 Z, }
} ' e8 R( ]) g$ y" |; E) N
, Z% G5 v( h+ H) j+ |1 u
try # R7 P" Z; X! [; N u" I @- `
{ / Y. Y9 O& h. Y2 i/ ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) Q3 E4 S! r5 @) l1 B8 E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - m- A) M6 j" j9 h# O2 F) l6 M
if (r == vbCancel)
5 H- \; i7 n& q+ B3 z2 O8 [ {
0 G7 O4 g4 R7 q e. P simple.CloseModel();
4 v, R! }* F) x! b WScript.Quit();
# R) n( A% s7 Q8 d) x }
7 P# f: W: ?2 ?! y$ ] h2 a( \}
! j! g- I: a! B4 L
3 z8 J5 R. j' e" M& d; b, hsimple.StartSimulation(".Models.Frame.EventController"); ! h% w, \. O; K
( H9 F' k( u& X! Uif (simple.IsSimulationRunning())
: L/ p. G3 _# M7 u+ K! X \4 p7 n0 W WScript.Echo("Simulation is running!"); - V H1 ^# Y4 V0 p0 R9 O+ Y) F
* z5 b5 Z! ?4 I$ |6 G9 x! W. o$ i
// Wait until simulation is finished " H( e, u5 x+ A* z
while (!Finished) WScript.Sleep(2000);
# m6 i$ j! M' ^) ?' w
; C: v {& m& n1 `7 zsimple.CloseModel();
$ Z$ i; b0 r6 Q' [simple.Quit(); ) s" G4 Y- k" c/ \3 G
WScript.Quit(); $ s* Y: H2 _5 ~0 ~4 @4 E
, W+ ]6 h. X$ S$ d
+ E3 b+ B' e# g; Xfunction RemoteControl_SimulationFinished() ) R+ e u6 J6 A: [) ^1 r3 _
{ ; B, u/ @+ g B0 k: j; C
WScript.Echo("Simulation Finished!"); |