Example of a JScript . P3 S! y/ J2 R
var vbOKCancel = 1; $ q* \- v+ ^' @7 ~' k
var vbCancel = 2; 0 I; | p& j9 e: e; j, u
var vbInformation = 64; % k0 ?, f! }, R6 b/ z0 D% w
var Finished=false; , y2 m2 O5 v( a. d3 w6 k
m+ |$ ^$ R2 ]/ Qvar WSHShell = new ActiveXObject("WScript.Shell"); ! f+ r, A; K3 E0 C e9 T9 i% o5 R
$ j( B7 G! V+ y9 U+ Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- |; T: _' L9 G8 M# @, r* u z
! \6 r2 b2 i$ S) {; q( C1 Lsimple.SetLicenseType("Runtime"); # i7 f6 F; U) k/ A
: }& R5 y0 c- s' Ktry
f I6 {, H' H/ P' |{ - v0 F( x* @3 @& \0 N) T
// Enter the path to a model file!
* C5 }3 l; J' W3 l1 ? C/ m5 Q simple.LoadModel("C:\\Models\\Test.spp");
/ w) V' z, k' i( R+ j0 L}
8 ?" D0 {' G; I4 x( }" ~) Ncatch (e) 4 S/ j. @$ _! w2 I$ k
{
) }! q/ m; a& X$ x/ A1 H WScript.Echo("Could not load Model!"); % Z! ]0 n% ^6 O+ `
WScript.Quit();
& A. D S7 p0 {$ K}
2 }8 b7 a) N' O" [! f2 f7 u: M
/ {* ?8 b3 S6 } t8 |: @try
. y9 W3 ^9 |% ?9 B; r/ W, q9 W{
5 N; ]" M$ ^9 A* s0 }/ S; k simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ S. B! v* ]! _ w$ f2 [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 u8 t, b; g v \7 U3 u0 A if (r == vbCancel) " X* i% R" F6 G
{ # E$ r0 V6 P- J
simple.CloseModel(); 6 R8 u% f' ? F; ?8 h: w6 ~ N: a
WScript.Quit();
; [$ |7 B, \1 x1 K } * ~ H" W% I0 |) ^% W$ n
} - b- f% P9 z8 G" c' m0 F
) m/ x3 j( I* S. `simple.StartSimulation(".Models.Frame.EventController");
1 [4 [ W# J, ^4 I $ k+ J& p% m7 u' Y
if (simple.IsSimulationRunning()) & H, X9 c6 c) H3 X" d
WScript.Echo("Simulation is running!"); 6 P7 } v4 { G1 j$ V6 B
1 S) e; f% J# y7 g4 p
// Wait until simulation is finished 7 [& B. b' M0 o& p J5 s
while (!Finished) WScript.Sleep(2000);
; {. g0 b, \- A U X& l # x9 D$ |- m, z2 @4 @( T
simple.CloseModel();
4 E$ y) Q* \+ f4 | Q# x9 W% S" ~simple.Quit(); 0 v: h; L# O3 t" b g2 v' U
WScript.Quit();
; p* C: ~4 @8 D- }7 \1 R! L+ j8 B
, r8 T: \# \; a( v! q # E8 q8 j [9 U4 `: ?- y
function RemoteControl_SimulationFinished() . t2 ^: ]" R7 a$ Y2 D
{ : _/ Q4 }# Z% K* I, @* u
WScript.Echo("Simulation Finished!"); |