Example of a JScript 9 j# j0 i$ c8 l V
var vbOKCancel = 1;
2 s9 z5 D( @1 h% i2 v- lvar vbCancel = 2;
. l C' k& p( ?, {: ?; |' ~var vbInformation = 64;
. Y: \3 o9 @' k# J0 J# Uvar Finished=false; & N5 n: U% Q5 w1 f5 I
7 g6 g1 m9 n4 R. a" d/ L) j3 i R- l
var WSHShell = new ActiveXObject("WScript.Shell"); 4 w: ?3 Z4 G5 X8 r6 @4 v
" f4 z" g: ]; F8 [
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 r& P. s9 _4 F3 x; G! B
0 Z, o& E% q* Y$ I! `simple.SetLicenseType("Runtime");
! h6 g! T$ h+ \. _, @6 ~- E+ p
, U/ F9 N7 j7 ?8 z- C$ B' ctry
) `2 V4 K% s3 L3 l9 A1 ~+ x{ 1 n5 n/ k2 o. \! m0 u1 ^% p3 h
// Enter the path to a model file! 1 \# b f" w, F m
simple.LoadModel("C:\\Models\\Test.spp");
7 f4 `" S6 ]: b2 k/ _, r, K}
* i9 d, ^ F* Z* ]* w Qcatch (e) 9 s) I7 {5 L# i( Z
{
! C9 G) m3 G) p8 F& u5 K WScript.Echo("Could not load Model!"); 5 D" t8 @% r; B4 ^. o- Y: G
WScript.Quit();
% J; J7 X" q f}
% \! Y) b7 e9 Y- O
+ u- q$ G! {. Z# d2 Z2 rtry
8 ?" i1 D$ S/ { ^& v( j{ : R7 a1 t; C8 z! h5 t8 v* \
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / Q: M/ X+ l" f& k* a1 Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 R8 j: p; v* }0 H+ H3 \1 S- @ if (r == vbCancel)
* m8 Z/ M( E. p! S4 E/ T* @- U {
# v5 v4 m/ n3 i simple.CloseModel();
( t# O! h l+ f! } WScript.Quit(); . B9 x6 ` Y% P+ y% B& d
} R) b# Q5 w- u% q
}
/ D& c$ P# D, l- J8 p 2 N# V1 F7 N5 @# C; `1 N
simple.StartSimulation(".Models.Frame.EventController"); 7 w: [! x7 D1 b, S' E/ ^
" H( v; Q- v* Y3 W; ], q; M
if (simple.IsSimulationRunning())
0 s- l8 n4 n3 g- R! V WScript.Echo("Simulation is running!");
4 g# A1 u& S- M" k) O4 D7 k# y
# p2 T/ k6 q9 W" M7 {3 z0 b6 q0 H// Wait until simulation is finished " g# [ g# H# n6 c- v# g3 J
while (!Finished) WScript.Sleep(2000);
* N. c: c) M. l3 I# m # J# M7 x! s+ P. S4 S
simple.CloseModel();
, N, E. X! V3 o& N6 q( @0 j) Vsimple.Quit(); 2 |8 |' H- B7 Q( G9 J2 `9 L0 t
WScript.Quit(); - @* \8 M! P( O( b T5 h
3 P1 g! D1 H: `7 c9 C( n2 ?
% p9 {! T' c) Kfunction RemoteControl_SimulationFinished() # ]! @% o1 b* A
{ ( O$ |6 Z+ S! X9 }4 ?$ A( L7 K
WScript.Echo("Simulation Finished!"); |