Example of a JScript
9 C7 ?* b% q# K' M. m$ [1 Svar vbOKCancel = 1; . X! k+ f5 I, M$ v4 `
var vbCancel = 2;
8 ~7 q/ C3 k) F5 j1 nvar vbInformation = 64;
. U( W! l P* W0 W t- F0 Evar Finished=false; 6 b$ B3 ~/ [$ S1 D" u% O
9 G3 ~3 v' p4 d; o3 Z3 u, @, gvar WSHShell = new ActiveXObject("WScript.Shell");
7 {# Q: A5 a! Y: r7 Y
9 c" V% ^1 c4 X3 Ovar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * p) y. c1 e6 i# T* Z; Y
# v6 q& L/ N# q) D- A) C0 z1 psimple.SetLicenseType("Runtime"); 1 W X: [5 g( j! p
8 D/ A5 N& O7 t
try % U/ t* e+ M1 z& v/ `2 V
{ ! S2 l K- x% u1 y/ I$ m5 X5 x
// Enter the path to a model file!
% N7 V# R* ~: d# U4 x simple.LoadModel("C:\\Models\\Test.spp"); ' Z9 O3 r) m. V; Q
} ! O: q1 K8 C; G! M5 S
catch (e) & L& f* j2 t9 M: s# o
{ * M, e' ^$ ~6 X' p$ [
WScript.Echo("Could not load Model!"); # r& H! r9 H. d+ p# B7 I' a
WScript.Quit();
% D1 [3 S- g* m0 Y. R; T) B* o} 4 x `8 S( e, R! `
7 H7 B0 Q' c$ }# \ ttry
4 M" Y. {' D! u, x{
8 Z" e Y/ ~+ |2 G simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. V1 V- `7 @# E r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 z" k+ m8 b2 y6 P) u* V4 I
if (r == vbCancel)
& S3 n, Z4 k! Y' t) }: D$ f U# z5 P { 3 j) c6 w0 f2 g; E4 Z
simple.CloseModel(); $ {! v* @! }& }. R; A
WScript.Quit();
- A* `9 [4 G& a$ h+ }! G4 U+ O } p5 x- {7 }. L8 ]8 O4 V
} 9 D- X9 L) j+ }6 V+ T
* d" v0 G( C1 }4 zsimple.StartSimulation(".Models.Frame.EventController"); - [% U, p8 [) ~& f, ]
+ Y7 |7 K( |0 [$ V# `9 c7 [! w9 Uif (simple.IsSimulationRunning())
" E! s6 @/ F1 C# x1 d/ C WScript.Echo("Simulation is running!"); 1 q, z& L1 \. A" M0 o* Y' ^ b
5 U' u) O0 \0 V// Wait until simulation is finished
* e- i' i+ f! c* |+ Ewhile (!Finished) WScript.Sleep(2000);
" o- U, x& J3 t 7 _* t/ U" R8 _# ~6 E" \# P7 @- U
simple.CloseModel(); 8 ~& C) F8 l. q
simple.Quit();
- s6 M8 b( I3 a9 f+ P% d9 s' TWScript.Quit();
* k% z1 x5 v& F( z; L& r
* x1 |# c$ Z7 ]* G4 ^, y2 A
* y1 W- e0 N+ \8 y9 S, w$ B% f |function RemoteControl_SimulationFinished() : J% y$ }. R: T4 p5 C
{ ) k- S& o9 t6 [7 R4 j
WScript.Echo("Simulation Finished!"); |