Example of a JScript 3 S) D/ s7 ?2 a0 o- p
var vbOKCancel = 1; ; c$ `$ x( w8 T- u8 z
var vbCancel = 2;
0 E* M, {4 D/ P) G- {# bvar vbInformation = 64;
( V; @8 S# u" E+ J3 X& Tvar Finished=false;
7 @8 Y, E. G% h( l3 F " W5 G8 Z/ ~8 x: M. ?$ r* C9 `
var WSHShell = new ActiveXObject("WScript.Shell"); ' }: [( t: @6 X
" N. g" u, v* }6 h" ^+ k; j e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. W9 |+ T# r+ y; I5 K+ i' [ * K! Y4 ?0 q4 |
simple.SetLicenseType("Runtime");
7 g1 |/ d R {; d' U1 w 7 t0 i7 ~7 A$ p& n! H% ]3 X( e
try
& u3 j. J& f4 b8 w{
2 {5 \9 O8 t/ p, k% ~ // Enter the path to a model file!
0 Q0 e& S& X$ ] simple.LoadModel("C:\\Models\\Test.spp");
2 C3 \- L |% _: G9 B}
1 b, H! \1 p& v' P2 z. gcatch (e)
! ^& K& L% d4 m5 d) M: d& g. P) B{
3 L. w$ w7 @2 y8 N2 I WScript.Echo("Could not load Model!");
+ G' ]& c! ]& ?; c1 i5 h$ r! @: t7 j( Y WScript.Quit(); + O) |9 i: V2 F7 ^5 u# V1 ^
}
) \2 a/ r3 [ O8 d
: k% N1 [1 J, Q! ?0 ftry
' F, a" c, t U: o* g# V{ ' T! B' e1 [3 }0 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# u1 c: v! s5 s6 D$ y$ L2 { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 [3 H7 K' J& q0 U/ S9 z: |1 C B- p3 ^* ]. A if (r == vbCancel)
8 X5 T! v8 ]2 }2 o) a& {7 Y {
5 }$ {8 D, u( M" o) t simple.CloseModel(); - m3 y% q3 ]1 a7 B
WScript.Quit();
t$ l# E b/ q' @ }
" d4 k! a) T% Z0 S8 o% K7 e8 C} ! A( k' T" ]; t/ c4 Z- z. I
" A6 D7 F. F* @( Z8 H7 T3 q9 jsimple.StartSimulation(".Models.Frame.EventController"); % o! {7 w/ z) e, }' m. C
# y- n# f/ M) L4 o+ r
if (simple.IsSimulationRunning()) ; z: z7 }4 w9 [' @# X) J
WScript.Echo("Simulation is running!"); 7 Y( V7 Y/ K# E+ Y0 S" O
$ n' O" }# K9 r+ s4 v* S* ?1 K$ l) ~// Wait until simulation is finished * X9 B E4 ]* T3 X! b
while (!Finished) WScript.Sleep(2000); : }. C2 }5 A2 [0 t- B- c, W
- r9 [) T+ d& H5 c
simple.CloseModel();
3 x$ y0 M2 p3 u+ ]simple.Quit(); 9 \. j- T% R! }$ i- a9 t" s
WScript.Quit(); 2 m* _1 [+ ?7 _" J2 @( Y& t) q& @
; M* q% y: H/ ~4 H. {
& H+ G2 Q5 v) r" {! k3 Qfunction RemoteControl_SimulationFinished() / j9 h0 Y$ g; c) H4 S
{ . \$ M/ X; j- |) M; j( B2 d
WScript.Echo("Simulation Finished!"); |