Example of a JScript
' m2 Q# v% C; R; R; f: F3 \var vbOKCancel = 1; 0 J/ F4 p" O/ }) }: s
var vbCancel = 2;
" c! L/ w5 Y, I9 Pvar vbInformation = 64;
5 n' e6 W, }. w2 X' Z# C9 }! bvar Finished=false;
) `7 A% v. K' H q) Y X
4 P, E+ u) k; Kvar WSHShell = new ActiveXObject("WScript.Shell"); & c" g2 N+ C- s3 m
4 k4 ?% U- y) I7 }. V: j, Z! A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; e3 {4 o! c& I2 H 6 S$ J& u4 x/ {' ^% V) Z. b% C. }3 A
simple.SetLicenseType("Runtime"); 8 M5 ^( t E( j) S' F
8 I k0 M" R# k8 V) htry 0 `+ _% G$ s$ D
{
& C7 e& Z! N6 \ // Enter the path to a model file!
* m3 G! k3 L7 l" e; x0 F7 | simple.LoadModel("C:\\Models\\Test.spp"); # T! _1 K2 d- o, N+ U( C6 ?
}
* v# E" G. g) d( Q9 P/ M; ^( ]catch (e)
1 U# b7 O. {0 a+ s1 l( U+ T; L{
7 q3 @4 y6 U8 ?6 F WScript.Echo("Could not load Model!");
4 t, d/ c) h: N+ g' t! N WScript.Quit();
( Q0 r( [" z F7 ~8 m- I/ o}
( j! Y) r# c+ b7 A" r+ M0 _* _
: ~8 o b' `4 t, Wtry 3 m0 ]! P7 P' ^5 O3 ?: n
{
, U+ n6 d+ g% k. b* Z# p" Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 C8 H5 d3 Q5 D) y1 ]! M) Y+ O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( x3 \5 v0 F3 A
if (r == vbCancel) + W7 |3 V ~* U1 G, ? p/ X
{
( Z9 k. d, x( J m* Z8 \& W" u simple.CloseModel(); 4 `5 @9 W8 Q3 [" \9 e; R; f
WScript.Quit();
4 r/ c8 K4 \6 W' x! a8 Q8 _. ` } 6 t. V$ b' P$ \, s! w
}
8 H8 C5 J0 I3 ^6 B7 y% P7 V) j8 A 5 i6 E W4 S' |0 k1 W
simple.StartSimulation(".Models.Frame.EventController"); 2 B2 |8 H+ z2 E5 R/ }% m4 q
$ _7 c( d' I( C6 e- c9 I
if (simple.IsSimulationRunning())
7 T6 q8 a. C8 A WScript.Echo("Simulation is running!"); , \( u* t: H" F
7 w0 D2 m) b" x// Wait until simulation is finished 0 }: T& h/ S7 d' w# e7 |
while (!Finished) WScript.Sleep(2000);
2 Y5 p5 A' f, U0 i& l$ G & S+ A- u6 I. d% I. t
simple.CloseModel(); ( T. N. w2 T& v" ?5 l$ s. Y
simple.Quit();
% [" l& J3 Q, i0 u; YWScript.Quit(); 7 O# r: E6 R& C5 t- Q
; ` H5 [! S$ ]
+ m* c. _0 P+ K5 {* ?/ |) N$ W+ D/ Kfunction RemoteControl_SimulationFinished()
2 [1 \2 Q9 T, w/ E2 s5 S{
4 K& ?$ O( d4 I5 [, o3 e. y WScript.Echo("Simulation Finished!"); |