Example of a JScript
$ `- x( r' r2 C% h# r) Gvar vbOKCancel = 1;
1 i' d$ s" R3 ?9 mvar vbCancel = 2;
7 x! @/ X+ d e) p. V0 O- Ovar vbInformation = 64;
% {" d' i6 x/ dvar Finished=false; + ?3 D& ^& \, E2 D
- p: d4 I2 T8 g& ^6 V0 a
var WSHShell = new ActiveXObject("WScript.Shell");
. L. Q) R2 e7 B8 p$ W! k. }* d - a" C5 ^( r+ \: X; G& {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) E+ y% L; z/ q4 X1 a# z
4 |( F: t! q7 t0 lsimple.SetLicenseType("Runtime"); ; {1 [8 H5 F, B Y* Q, ?3 B
8 X- M+ g) b" ?
try
1 _ ~: t& K! z5 V{
1 a6 v* ?- ~4 g8 G: n( \2 ^7 m // Enter the path to a model file!
+ C$ R$ g8 _) L simple.LoadModel("C:\\Models\\Test.spp");
3 g( W0 \" Z' u1 L9 S4 x}
" }" I: ]- ]* Q1 Ucatch (e) g0 v- g$ N3 Z Y
{ ( `* s8 X- h- d% m
WScript.Echo("Could not load Model!");
* d9 o$ {7 O) C# j1 X, u WScript.Quit(); ' l# Y) p* e g; I1 f/ k0 F
}
" z' M) K5 B% e9 @: h
8 D8 ]% n* P: X) \try
& K* J" B" x( N) j' E% ?9 i{
2 V3 {, `* V( o* T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * w' P: f" ]/ {' |6 v& ~+ z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 g p$ w1 C% n3 V+ ~) l8 [
if (r == vbCancel)
7 J5 _" o l( q0 y; P {
0 T. H. P; S8 Z# r' V simple.CloseModel(); 8 \# ~! _1 a3 B. g+ ?
WScript.Quit();
5 Y6 Y# `% @0 w# v6 d6 P* l, X& R% j }
. E# v7 T# B, q8 P}
. z! c B# C0 S6 o f i( m1 j, U
, U3 D- ~1 t6 G; p! h G; k. x4 Ksimple.StartSimulation(".Models.Frame.EventController");
# E p1 U# r* j4 G9 E9 I V
3 m* v" D# V- Z! [; Gif (simple.IsSimulationRunning()) - y/ J9 S: c, R$ _! J# |) g2 N( n
WScript.Echo("Simulation is running!"); 6 h A) W8 f. w
# q8 y2 P1 J6 {+ V// Wait until simulation is finished 0 V8 S5 v$ W( } M
while (!Finished) WScript.Sleep(2000);
' O( w' ]2 f& D$ A; C9 Y- E$ \ $ |4 S2 l9 J! Z, `9 n! Z/ [* s
simple.CloseModel(); ( L, [6 [4 t8 |- T! o6 ^
simple.Quit(); H! i" c+ z; o* O
WScript.Quit();
. \+ S9 [% K3 D ) t. C. `9 M5 J1 b) H
7 D% B$ S6 c, P% F1 Xfunction RemoteControl_SimulationFinished() X6 x% W% q/ s; B/ d1 `8 _
{ ( V) L0 U4 V2 U! O
WScript.Echo("Simulation Finished!"); |