Example of a JScript
( \& H5 f' O7 P% a5 \var vbOKCancel = 1; + F9 Z7 p2 @. L0 R, h7 l# g
var vbCancel = 2; 6 s; n& e9 g* Z4 A! u
var vbInformation = 64;
b: a. c. h; `4 E& ^7 Wvar Finished=false; 8 x/ X, W4 o+ g6 U" J9 ]- G
$ m5 B- V$ R( T3 D
var WSHShell = new ActiveXObject("WScript.Shell"); % k4 f$ M' }5 f2 O. \
2 P& V( l7 S) E f6 l* y3 C( @% T' Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ l; j7 A+ a' h8 b
2 a0 P( W% G- t+ C# H* B# q- S3 i
simple.SetLicenseType("Runtime");
, b \* o; {+ b & [, ` l, Y- c& m z& Y' O. l
try
2 }$ q% O; Z N5 Y b( \, H{
# a, R E; A+ | // Enter the path to a model file! 1 s" [) d+ s, G7 ~! i7 U
simple.LoadModel("C:\\Models\\Test.spp");
; L$ Z6 [. S# P2 I" W} $ P6 |; J; P. p" _) t: y+ |/ J
catch (e) 2 F6 P! S' T) F3 W! b
{ $ `; { x- _3 H ~, l
WScript.Echo("Could not load Model!");
- G& [. Y, l7 L0 D* T# ^1 n WScript.Quit();
1 `- T @" \7 ^& v$ ~% i}
" B" J) d% M$ [, n# Z
; k4 {; i5 {$ g# F1 e- {try
' G+ D5 K4 e( E4 \{
8 U0 ^4 l0 R4 M6 p8 W4 |9 }: F simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * |) W5 n: e$ c. Y2 y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & Q) N: S5 y$ N3 U& E* x6 o
if (r == vbCancel) ! o5 k2 g2 o# G' v. A- j! d( X
{
' [; F5 v# Y1 e* l' Q simple.CloseModel();
% t6 _+ C/ o. {0 s o! g WScript.Quit();
! L; w9 D% l5 N0 n }
& a5 O' x' g% B9 ]}
$ |) |! j! Z% o+ Q5 X
7 W8 I/ N1 J3 J1 Dsimple.StartSimulation(".Models.Frame.EventController");
; `8 B) f0 M$ ~2 B: \3 a
- w. Q1 W0 u, Y$ E& l" R9 }if (simple.IsSimulationRunning())
2 D) a7 M- Q6 ^2 t- G WScript.Echo("Simulation is running!");
1 s' z) a3 Q& E, v
8 s+ G. r. ?: f8 Z* P) [// Wait until simulation is finished 5 I" Q$ H* ^( g- w* J2 S
while (!Finished) WScript.Sleep(2000); % }5 f: S) l" J/ [8 {+ T
+ z: Z5 h& h# |2 {; msimple.CloseModel();
% Z2 j6 h* ?" X( K" m# }7 Y7 Q' Lsimple.Quit(); . J+ ]9 \, w1 |. d/ T- o/ o( D2 E
WScript.Quit(); + L1 d, ]' L7 Q' ?9 e1 e" O
: u ?1 B. D$ Q 7 r/ I' L1 G4 Z% u. c8 h
function RemoteControl_SimulationFinished() 6 O: b" w5 b4 ?- o1 M4 t. u
{
N8 `" w; r( p/ ]5 P WScript.Echo("Simulation Finished!"); |