Example of a JScript
" P' x) h& d# x, U4 F7 _: V q' Jvar vbOKCancel = 1;
' V1 Q: }9 l7 ? A7 ]& l* t! [. i' Nvar vbCancel = 2; % f& y _6 a2 B6 [; w
var vbInformation = 64; & Q6 @$ V; X: P$ s" D. u
var Finished=false; ; s0 d6 Q2 G& d, E0 i! Y
/ p: b9 ]7 q4 `7 H2 Q fvar WSHShell = new ActiveXObject("WScript.Shell"); - m+ A0 Y! B" o F/ i0 I
7 a; C! `5 S1 A# d, q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ U! ^& p& C/ l! W: \, \0 {4 ?, k: }
$ M4 J( b0 s- w6 } B8 ysimple.SetLicenseType("Runtime");
2 {( [, b4 H! {2 O4 \5 S / [! O9 j4 y: x6 o
try
# W$ u3 J" w: ]5 ^. L. g5 u{
: l/ x) T; Y: e5 H8 d7 W // Enter the path to a model file! $ ~$ Y. Q% W3 E* p5 c5 Y0 t; p
simple.LoadModel("C:\\Models\\Test.spp"); K L# y' H3 T- o4 V" u5 v! U E
} 9 P- \+ h0 G- ]$ K6 S5 M
catch (e) ) I# e5 g% f+ R) Y
{
. {# l7 T$ R5 ^ WScript.Echo("Could not load Model!");
9 B( A3 m# S1 W8 c9 G WScript.Quit();
6 E( I, f: I7 @; f+ {}
- A: d+ Y9 ~; D: u g4 |9 g* z; E) [' \, K
try
/ h, D" ^7 Y4 ]{ + e& P9 z6 `% A0 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 ~1 g2 ]% Y$ T# }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / S) X! C$ H; ?; |
if (r == vbCancel)
9 ^2 I$ s. Z: t* i) |8 K" p) N {
6 E' p$ e& ~2 E; G5 `4 v9 P1 ~ ~/ S simple.CloseModel(); 4 o5 S# L' t; y' {9 T6 W l: m
WScript.Quit();
$ I/ B: {% ?# ]7 f: a9 l } 8 Z" ^: S5 K: P# b
} 7 C0 a- m8 b8 m$ ]& F
3 m' O% P% l, f2 Vsimple.StartSimulation(".Models.Frame.EventController"); # b* E7 f) K i% q- t
" m9 q$ }' X1 O5 D
if (simple.IsSimulationRunning()) 4 L+ h* l; j! R. D
WScript.Echo("Simulation is running!");
3 a4 f/ b) s6 u, k$ ~8 n$ A- e # L& T' g5 ~) F# u
// Wait until simulation is finished
3 E- Z! B. f" i$ swhile (!Finished) WScript.Sleep(2000);
6 i" a! r0 G# n" H$ O : ^7 F! n& s1 p; y: _
simple.CloseModel();
" v$ G* c2 S0 l# W/ C5 T L& \! Ksimple.Quit(); " N) E7 L9 p' E- b; h
WScript.Quit(); 5 f0 X" ]3 E9 s" \& e4 b
, d7 i# x0 I* {1 n& R) K# A+ u
- ~! g6 `! R3 r# J
function RemoteControl_SimulationFinished() 5 y' M& p: |( K2 H0 ], t
{ " a! t; I9 }& E% P! B
WScript.Echo("Simulation Finished!"); |