Example of a JScript
/ T! P8 t# L. Rvar vbOKCancel = 1; 2 T' a* w7 J* N" w p
var vbCancel = 2; 3 ?3 Y1 J A# R% X
var vbInformation = 64;
4 @. ]- b" I* ^) d4 ]var Finished=false;
/ {# N+ B" r, J6 E% r k, H 6 x" R& F, f# q6 p
var WSHShell = new ActiveXObject("WScript.Shell");
8 A# d i: c! S+ h- y . k' M, a( R3 ?" g* n, U Q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" q3 H; B$ c- Y# M2 g3 L5 p0 u" F' ]
9 S. ~: i* q1 l4 D* M: N& L' J! zsimple.SetLicenseType("Runtime");
. E$ o! Q. T7 e: P3 ~ ) N1 z6 o8 b& T" s
try ! e3 A. Q" K! |3 e7 S
{
- ~ Z" e& M6 r) x& R3 W1 S+ j! W // Enter the path to a model file! 5 ^$ B: r* v8 K: i' n; e1 I
simple.LoadModel("C:\\Models\\Test.spp"); 8 S; j2 D; |( E2 \. z9 a; B* J
} 2 @/ X4 ^% ?+ f) p+ l
catch (e) 4 ], y% k" s. X3 X) s" J0 B
{
5 D. s, S; C6 `! g WScript.Echo("Could not load Model!"); 9 d' j+ s7 A- A9 h1 e, ~# o
WScript.Quit(); + b$ ^% m) r* z$ u
}
" l! ~4 X; U! H n( y' ^! c+ F 0 J2 b5 k+ ~% O2 E* L* e7 S
try }3 |& h' h5 u0 O, ?1 e
{ % ^ n; i( ~+ y! S$ D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 [3 h8 R1 Z5 J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - ^0 y0 v' {+ K' f
if (r == vbCancel)
2 }, ~/ I/ D/ I7 V1 G! V { # h! s3 C3 P* q. y
simple.CloseModel();
N* E' K9 V) \* Y WScript.Quit(); . e0 e) o* H8 A
} 9 h7 g: o. E. D: T
} / ^! m. S0 x* e
5 @: P7 C8 L& X5 Q# h% A A+ gsimple.StartSimulation(".Models.Frame.EventController"); " @% ^1 b; v% u. m2 s; H) O
! o, p; O7 |. F- N3 M& Pif (simple.IsSimulationRunning())
0 S6 M, a, M# R; v* H WScript.Echo("Simulation is running!");
# I+ _( r* z* C
2 n0 _5 U, {, E! ~+ J: U- w9 x7 ~, W// Wait until simulation is finished 4 \: m* ?% @$ e' m
while (!Finished) WScript.Sleep(2000); 5 t% {' Z9 s. w$ G
% w7 q3 S( N5 ^
simple.CloseModel(); # [6 r7 A V! M: r% E. }. u
simple.Quit(); $ F6 T; t, r9 f4 d# [
WScript.Quit();
; V+ a- P0 d7 g9 T. u& y5 E7 | 8 v0 t' r; n3 t
0 i1 P p6 _* m. _" Qfunction RemoteControl_SimulationFinished() / z" B( }7 Q( Y6 O( A' r
{
8 V; {0 s7 c& S8 k0 f* K5 [1 |$ z WScript.Echo("Simulation Finished!"); |