Example of a JScript
( l0 K4 g, A. [! X: p! @9 N3 Svar vbOKCancel = 1; / u1 Z3 u/ B; Z4 F) c- `
var vbCancel = 2; 4 z' t3 M! L0 G4 \
var vbInformation = 64;
5 N+ a d5 G& \* L0 C+ yvar Finished=false;
7 W% U2 j9 y- G) @* e: L N ' ]5 S! z$ s/ j. G" m
var WSHShell = new ActiveXObject("WScript.Shell");
* ]0 q0 d$ B0 V) J- s5 O & S' @/ V M4 y1 A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " O) v& M4 |" H; s* d! }5 a
' `- W; q* c, ]' s7 f. i
simple.SetLicenseType("Runtime");
2 B: ]4 U7 e( q 6 H3 o: H1 H- h+ d& o
try
; c ?+ U5 X* X" ]+ \6 i0 I{ 8 k. ?! d( M% s y0 t
// Enter the path to a model file!
7 P- Q0 D( V. M4 ~/ P. w0 X simple.LoadModel("C:\\Models\\Test.spp");
9 Q& x3 l- J5 t! l} . \( C" t2 y3 `8 i
catch (e) 9 p4 w) W) C3 {6 ?% H
{
( e& r) }5 O( Y. o# ]9 ^) y+ | WScript.Echo("Could not load Model!");
9 U6 K% t, Z# B9 K% E1 p0 D WScript.Quit();
7 u9 H2 a' a8 [' D} 6 o) i) [$ b! y+ _
* S; R# E0 [$ g; j1 c! Dtry " f9 T9 p$ S3 G+ v( a$ ^
{
, |+ j7 x, L4 M' J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # e) C. h+ a. E- i+ A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , v2 e7 R" t( \5 g: Z
if (r == vbCancel)
+ n) j" a. o3 u6 h# E {
! L7 W0 _4 L# Q+ l1 _ simple.CloseModel();
. H# A% I3 o' j$ C WScript.Quit(); ; c2 J+ }+ R5 L! A+ @% d5 ~
} ' Q4 @# O8 X$ |( |! u
} 5 d7 z# {$ m' d4 p5 R7 n. d
$ ^( V* y6 f1 T
simple.StartSimulation(".Models.Frame.EventController"); ; o! |" g+ f# P' c, F8 {
! S0 H$ s5 j. s e5 `
if (simple.IsSimulationRunning()) ; C! p( r4 r" B) S6 P
WScript.Echo("Simulation is running!");
8 m1 L$ q6 s5 S$ i ) f* a/ O. {) B- F4 O% I
// Wait until simulation is finished ! r6 F/ G, F1 q/ P" N0 b! L9 z
while (!Finished) WScript.Sleep(2000);
) ]1 J3 I9 A3 u3 x9 b! H7 ~
0 Q$ `3 L0 w, x3 U8 U$ ysimple.CloseModel();
" ~. u$ [/ O9 F: M4 Psimple.Quit();
7 U# ^! Y6 F5 @0 a& Q/ u6 F/ BWScript.Quit();
4 K7 R+ t: A k; }- E6 a$ F
/ y" n& N) F2 m1 r( [5 m# y9 N* f 0 D" c. n) s* j) Y7 q- C+ ^4 f
function RemoteControl_SimulationFinished()
. t) h$ i6 \7 g3 x- s{ 8 j/ }. o9 q* \1 i
WScript.Echo("Simulation Finished!"); |