Example of a JScript
& u7 B! A! r% I& n- evar vbOKCancel = 1; % X- p8 ?4 x: ^; K
var vbCancel = 2;
. y2 N: ~: L9 f+ F5 hvar vbInformation = 64;
" @' X( g7 b+ o' {var Finished=false; % S5 c$ P; I1 i& K8 [) I3 m
4 u3 S4 `3 R2 F6 t2 mvar WSHShell = new ActiveXObject("WScript.Shell"); # J5 Q: N6 Q: C: N. F% d/ |% T, f+ _- w% T
6 I* l; I" |5 l9 Y. q6 K- U8 i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 M, a" }: S9 ~% W7 S* F8 f$ b
9 A/ e/ A9 T+ z: S
simple.SetLicenseType("Runtime"); 4 x3 |' \- S) s2 X
3 c# l+ w \! ?) B7 R/ _. Y% Ftry ?3 T/ S$ X' {4 [$ F
{ & p- |& X2 }7 p( t) V( o
// Enter the path to a model file!
6 i0 q& A* u% R2 C8 I. L simple.LoadModel("C:\\Models\\Test.spp");
# c5 X8 W' G9 W} 5 V6 a, D$ J F; Y
catch (e) ( G2 o0 s/ b9 J. z6 Y
{ 9 o, t. l& }3 F- j/ M
WScript.Echo("Could not load Model!"); 4 t8 p; b" T/ R5 S; v7 F
WScript.Quit();
7 O7 [; Z* s- u! j0 o% d} 4 p/ `5 A e& n+ c) x d
4 ]/ L/ b% m9 l) Y9 n8 ~
try
. x. ?- ^( e. W{ $ W, g$ m3 p+ X% ?7 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& v2 C5 m; @6 u# V r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * P) [( _! V' S) n+ E$ E: [
if (r == vbCancel)
9 n7 D. Z0 ^7 v+ c" p { $ C- B- Z; I6 b' G0 x
simple.CloseModel();
5 F& W, X$ k2 b$ N" R& F WScript.Quit(); 8 U2 E. G6 }) g, a" |. u: i' E, s
} & @! L$ G7 D- l$ w
}
. d2 ~4 o: i" X+ H4 m! f & M5 W8 c+ g R4 T' ]8 b
simple.StartSimulation(".Models.Frame.EventController");
i2 k( E2 [' @# N: P
" n: v- l' ^; ^# H% C M: [4 a2 wif (simple.IsSimulationRunning())
) t, O$ ?. [& G& Z WScript.Echo("Simulation is running!");
* o! U3 A: z# ]# r % K4 \: h, A" g6 ~( j- J
// Wait until simulation is finished
9 ~9 ]! D& u, F3 F7 u3 c# f5 D! iwhile (!Finished) WScript.Sleep(2000); ( s) H1 F, H* F
6 e* v6 w2 ^1 ?! f
simple.CloseModel(); & ~# [1 n7 g% }3 ~0 T
simple.Quit(); : V9 c* t9 r {! W- i% ]5 c3 U
WScript.Quit();
' W- A- k* x( k0 v0 e
% B1 o& ?3 p1 y) J* @% D( M4 O
' L$ u6 F" i) [# efunction RemoteControl_SimulationFinished() 9 J# `# z2 y% Y6 B4 i* }; B/ v7 w7 v, N
{ 5 P7 S3 w5 \) v. \1 u
WScript.Echo("Simulation Finished!"); |