Example of a JScript
6 _) X0 A) ^! Wvar vbOKCancel = 1; 8 I% \5 B- K4 F" m
var vbCancel = 2;
" t( f# c' g9 }, ~* Evar vbInformation = 64;
3 ~7 I2 _8 P9 \+ p. |var Finished=false; 6 U+ W' U5 j h( S
^& Q8 O4 J5 w# kvar WSHShell = new ActiveXObject("WScript.Shell");
' Z: P) q- [8 w' x6 E
8 _- U9 {, @9 u( V! _+ d5 Mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ o: B% N& Y1 ?; g 0 P7 h+ I: s# z6 \# A
simple.SetLicenseType("Runtime"); ( P5 Y% q$ W& q; R# e
& w r6 N& d! x6 D P Utry , s7 c% `6 h; S0 t' b& @
{ & q: W! A" v7 Z" _9 m8 G3 T4 y
// Enter the path to a model file! 0 x5 w1 ?9 O$ U E( M) x1 C
simple.LoadModel("C:\\Models\\Test.spp");
5 {4 p. S* G1 R# }, O! ^) L} ( F% Y- X8 a/ J' V
catch (e)
- c( L$ v$ c9 R2 C* g9 j" W{ 9 P7 I& ^4 o; W8 F; z% I6 U
WScript.Echo("Could not load Model!");
- G! X A" I1 x `* ?; L WScript.Quit(); : x# t' E; U" |+ Z: x0 s
}
5 e) n! ~3 k* m & D' N8 {7 ^# r: ~) G
try
$ w% d1 c( |- I{ * f1 V4 B8 l& E6 i5 N+ w* n% C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ K5 _5 r4 c7 G! ~$ | r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 W& ]) \$ A2 I+ D5 h0 H5 f' X8 P if (r == vbCancel) 4 x8 @! m& x6 W# o& k. Z# c) D- d
{
& b. g8 v0 y4 f4 {( h( M, v6 F simple.CloseModel(); + q! p+ o# ~0 K( B" o
WScript.Quit(); . r. c9 b5 R2 d% [0 g
} 6 s1 G0 f h7 B0 t# |
} ' H; n/ s+ L" w! u3 ]
$ p0 S+ i$ @) e% l# r1 W9 t9 [simple.StartSimulation(".Models.Frame.EventController");
2 `7 c0 B3 |3 Q7 v 5 m8 ]5 P7 D% {0 Y" O; \" C( ?2 J
if (simple.IsSimulationRunning())
# {' M, ?$ ^4 q8 r2 j WScript.Echo("Simulation is running!"); # R( c$ C. }5 ~, i% B
. h# C# ?" ] {, @
// Wait until simulation is finished
3 v. b! Y$ Q/ Zwhile (!Finished) WScript.Sleep(2000); & m7 O5 M1 i" h
2 b' C6 r! g) R& x4 R7 wsimple.CloseModel();
% }+ m4 ^& N. [' C1 ssimple.Quit();
0 x0 x- M; k: d3 KWScript.Quit();
6 K- y+ m( ? r0 Q8 ^; A2 Z7 V5 t , G0 L8 D8 m8 Q5 g8 Q/ F; V
$ M* q9 m/ R. R4 K7 R* I& N
function RemoteControl_SimulationFinished()
! u6 }, }8 I+ J0 e5 N1 \% C{
, y9 m& n8 P5 X1 W WScript.Echo("Simulation Finished!"); |