Example of a JScript ' d. R5 g+ r7 x! G! C
var vbOKCancel = 1; 1 a% K( v6 R0 J) x( T2 }
var vbCancel = 2; 4 S7 A) a, a8 C2 @+ L
var vbInformation = 64;
0 {- [1 J+ B4 xvar Finished=false;
% `/ X! P$ [+ u6 o7 p' j 5 ^( l# `0 f0 f6 z" x9 i% |$ O5 B
var WSHShell = new ActiveXObject("WScript.Shell");
: t% ^5 T6 p: M6 f. W5 a+ h, R + Q7 f1 I6 `7 S }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& N2 G5 B0 }0 C) A q2 B3 M; f9 x % N9 B, g+ a5 E0 H& @0 S& s+ G
simple.SetLicenseType("Runtime"); 1 d: l$ V7 q8 p( E; ]+ O
! I! _, x" U. i9 Y
try
8 B) Y+ N+ R( z{ * K' s) l. {0 I" g, K4 H9 H
// Enter the path to a model file!
- j2 N; E- r: Q simple.LoadModel("C:\\Models\\Test.spp"); ) s9 B: ?6 Q+ p3 D% J6 D
} & X7 T8 h# r- y% c6 N
catch (e)
' k) Q& h, f# u m8 _) |+ s{
1 y4 _7 g# w% a3 Q& a WScript.Echo("Could not load Model!"); " {' C" x) w8 y) [% W
WScript.Quit(); M2 r3 T1 ]9 z3 d7 v* W! h1 W
} ! ?! Q4 C7 Y; x7 Q- C& z
. x: V/ k* N* y4 g' S2 ]; @, [try
% j% {' K v% {3 z, ^2 t5 n& L{
6 a5 w0 s. d: w( \$ W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; S$ X1 w( ]8 \& H1 B! Z F r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - A/ c3 M. F7 b) \9 Z6 o0 u
if (r == vbCancel) 9 E' V' a! K9 ~$ S
{
0 G. y! A/ K A; z simple.CloseModel(); ! _, g+ c. b9 c* `% w* z
WScript.Quit(); 8 l. ?8 [1 h+ X: M2 z: c
}
) a' X2 d t" h7 u} / P4 ?! r8 E/ X0 s5 z9 ~
, d* s) n' Z- u7 e) ?9 E3 S
simple.StartSimulation(".Models.Frame.EventController");
, r8 ~* l3 e- U8 h. U 4 b. q) B) t+ o; D9 D1 r4 M x
if (simple.IsSimulationRunning())
/ `( Q& e, D6 ]+ y3 Q WScript.Echo("Simulation is running!"); 4 r5 U ^3 ^/ D& x6 J
6 k& U+ O) K. F2 l$ F1 J// Wait until simulation is finished
, ?/ Y1 L4 ^! ~: H& }while (!Finished) WScript.Sleep(2000);
3 ~! R1 k+ F+ {+ ?6 ?$ I & D) U( T/ F4 i# \2 i+ l
simple.CloseModel(); 7 \* Q1 u' X5 A! A
simple.Quit(); ; I: `5 ~0 p. Z. M) i0 |0 T
WScript.Quit(); % I( `: h& A: X/ J* `5 f% _
( L. m: {, a7 p$ Q' c I3 d& D) T$ F / B& E9 e9 y; q' T. k
function RemoteControl_SimulationFinished()
2 @4 ^6 T$ H( K. J{ 5 v8 @$ e3 B6 X
WScript.Echo("Simulation Finished!"); |