Example of a JScript
, p+ _ j. D- |7 e; Tvar vbOKCancel = 1; % |( y5 [( z* f' C$ Q3 `! q8 F
var vbCancel = 2;
' x, y/ |% A. {5 N, d3 w9 Gvar vbInformation = 64; ' k$ M+ ]2 y" y3 C. V1 i0 d
var Finished=false;
5 J! ~/ Y" M) K 8 G! Q5 d$ B. K
var WSHShell = new ActiveXObject("WScript.Shell");
: G6 a0 P9 r. Q' v W7 A! W' N, O
6 q* v* G5 o3 g1 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 L* r- H2 o* v7 ^% s7 R8 K/ {
$ b7 l) q, ^+ c9 s6 p) e8 W
simple.SetLicenseType("Runtime");
/ M% t& [6 I" `0 p( d, C. w* C
8 v0 @0 r# A' q0 M: o) r# M$ Rtry 5 Z4 Y' J1 X. c. Z- d
{
. G; ~) G4 S( l# ?7 u0 b) d9 a/ u // Enter the path to a model file! # _( k2 _8 J' N8 i9 n% M* B. n
simple.LoadModel("C:\\Models\\Test.spp"); 6 b7 G' A1 |2 l u" A8 r5 m! I
} 3 i1 s5 J1 |2 K* h1 m4 @5 l
catch (e)
5 U3 y& m6 E0 Y' m! h9 O{
+ m! W2 u" G5 h p6 T WScript.Echo("Could not load Model!"); + ^2 g/ F% G" p: M t
WScript.Quit(); - T3 B) y h, W3 |3 Z
}
1 O. w+ h0 r) f ) T. J6 Z" k+ N; n
try 8 H6 e6 K. c7 I) E2 m0 ?
{
r, a4 E8 b! u. W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, Y1 F% s( ~0 h6 X0 r& t r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 ^' Y' x; g& ^3 c6 z
if (r == vbCancel)
8 ~( o2 {8 g9 A! m! G$ q6 G) C {
4 X' K* A8 z2 i9 _+ v simple.CloseModel(); + s6 M4 i/ W: j5 K
WScript.Quit(); " h9 E# C5 m8 i4 a
}
. `: J; I$ i% y+ j$ Y e' }! h}
3 o* Q- J) [4 J 3 @4 l% z" @% N ]& @
simple.StartSimulation(".Models.Frame.EventController");
" a: U; ^ \* ~6 S. Q6 Q) F1 ^ 1 J! D. R ~6 U" L1 \
if (simple.IsSimulationRunning()) : h! N4 [' z+ ~$ I# X- i
WScript.Echo("Simulation is running!"); + [1 i4 r. U( R: m! }
+ u9 @+ j7 \3 |) d# K" U. J// Wait until simulation is finished $ e6 u) p; _) v" x1 i- G
while (!Finished) WScript.Sleep(2000);
% `# ], H9 p6 H! r: a
# v5 h8 M. w/ x- N, m3 G3 N' Z' `: q* @8 Jsimple.CloseModel(); . i H" H4 F( ?4 z# v2 l
simple.Quit();
; K- C% W0 |6 o, R b( K, k: iWScript.Quit(); ! R, U4 x/ f* O$ B7 f
7 r! X) z( |+ f( \ 3 r7 q8 v' \. `% S
function RemoteControl_SimulationFinished()
8 m$ U/ s6 F% O' p' \2 K5 b9 D{ ' U; c$ {' Z9 s4 y' @3 P
WScript.Echo("Simulation Finished!"); |