Example of a JScript
, `# _' T, i& S" R2 Evar vbOKCancel = 1;
& [! Q7 \1 o' ?3 x8 Qvar vbCancel = 2;
- E4 e3 z3 g* e" Gvar vbInformation = 64;
& [1 L4 O& h" T( `var Finished=false; 0 ]# v6 H, w+ G0 j2 g
) F2 [ I0 q& [0 P9 W
var WSHShell = new ActiveXObject("WScript.Shell");
! t1 n& X ] U
9 a6 V1 _. z, avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . L8 e' E$ j7 Y9 V6 _0 ]: y( ]
; O# y' B3 O1 S! z' Ysimple.SetLicenseType("Runtime"); # j6 ?0 @+ j1 {$ m5 d
% a/ m l& n) _) o
try
1 E l' \7 \3 t9 G{ # ~5 g4 N' `4 x: n/ E! c( V
// Enter the path to a model file!
$ _1 b9 i& ?: m9 x+ q simple.LoadModel("C:\\Models\\Test.spp");
3 I2 O9 V, n" l1 U1 H* S}
5 P1 V, y2 F1 u3 ]catch (e) 9 p+ X3 S; q0 x2 n" [
{ & m1 r' |. e. E0 |
WScript.Echo("Could not load Model!"); . {7 L, U# T8 m3 h; W
WScript.Quit();
g! o: F" t& v/ Q} . I# M( g( r# U+ o
! I+ h5 b+ @# ?
try
: ?3 f8 N* U; Y& W* Q2 K{ 3 h' Y8 H' h0 D0 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 O5 l% W* {. u2 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 @3 k( I; P: I. z if (r == vbCancel)
# A: y2 }0 [, Y" z! }: S' h { 8 }. U) ], [8 i# \$ Z# }
simple.CloseModel(); 4 u& t- G4 M7 [' f
WScript.Quit(); 1 `! P6 L! {6 |5 [5 L
} 1 T( W9 D) O7 u1 K
} # s% a, @/ ~4 {
* U' \2 y2 E1 |. @8 R9 D+ B3 asimple.StartSimulation(".Models.Frame.EventController");
4 I, C" U$ b' |! Q7 n% e1 {) N( ?, C
% ]5 L5 t! Z- _: T3 Jif (simple.IsSimulationRunning()) - N: I: v% ^& r( F# O# `: q
WScript.Echo("Simulation is running!");
1 g4 P3 V6 A) h7 ^/ e/ k
# }, E* K3 F8 I E' n// Wait until simulation is finished
2 c3 Q7 Q6 x7 qwhile (!Finished) WScript.Sleep(2000);
& ?7 C l5 N7 y( i0 F# ^. X 0 _2 D2 V) m" G9 ~) B7 B6 B
simple.CloseModel(); - k& Y) u2 q/ a/ y) n
simple.Quit(); ! h$ s/ B0 E% l) y% W5 J
WScript.Quit();
; B* k2 m, U' @! f' Q# a2 e
, G: q( j1 \- S- u
1 G f/ h. g( u# D0 G' P# A! }function RemoteControl_SimulationFinished() : K5 O' o# H+ \+ S8 c
{ % @1 C& O% L* u& t
WScript.Echo("Simulation Finished!"); |