Example of a JScript
3 A/ T; T; x$ f! ^8 D: x) h& gvar vbOKCancel = 1; 5 E0 n4 \5 B/ y
var vbCancel = 2;
3 O- U( P8 A3 S( q3 \- ]var vbInformation = 64;
' S' R* M- M: P) G. ~0 dvar Finished=false;
4 c1 w B6 t. r& \# u
- H! J' ^" M6 X% Bvar WSHShell = new ActiveXObject("WScript.Shell");
# u1 }$ M' B4 c. A+ z5 t
( R# V& @" ^6 Z0 M9 i3 }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 E8 W+ @. A2 v& x0 Y
, h+ n1 m3 u6 b0 G b
simple.SetLicenseType("Runtime");
: c7 z& {5 ?+ [+ X$ b
4 Q2 v% P4 d( J' a. k: @) d: l: P h5 {try
/ `; e6 q% X; F9 F{
8 l" m3 i& _8 T$ t, P( l // Enter the path to a model file! ( v3 j- p& I1 ?. C
simple.LoadModel("C:\\Models\\Test.spp");
, z/ }" a. r/ g* S' n! Y i2 T} , }7 v2 e4 x3 K2 o
catch (e) * H) G1 b+ H5 [# s
{ 0 \9 _% ^1 z' J3 z
WScript.Echo("Could not load Model!");
9 n5 n3 A, n7 Q Y3 b4 I/ u' j WScript.Quit(); . m2 f4 F7 j+ c5 k' {4 j# X
} 3 X# C: H" p! U# g4 b! W4 N1 x
" M# y9 }, G# {( c2 d/ y' otry ( e7 e% l1 F" L6 f9 ?- p
{ ) Q) B y# ~, P1 h
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( V$ Y% w' W) D4 T) c& L+ c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); |" {% [ g( H* M9 U& L; N) i
if (r == vbCancel) ( o6 _! D5 d& V% R0 G1 v
{ # M9 w; s" A- ~. d3 I- t- e* L; k
simple.CloseModel(); ' S4 G+ i; p1 W& o
WScript.Quit();
; m' M: }% r# U3 v: k } / ^( g/ J/ Y7 Y- J8 S
} " W1 _- d& u: v" Q
( L ~! g X9 O, i0 L+ x
simple.StartSimulation(".Models.Frame.EventController"); 7 }* r: w7 X# k7 t$ |9 s7 U
" r# Y/ Q' V2 M! Z% x2 E
if (simple.IsSimulationRunning())
7 x* J% u$ H$ b WScript.Echo("Simulation is running!"); - h5 K( d6 e- ]& W) ]" P) [4 |
2 ?7 r; \2 n/ K0 n c// Wait until simulation is finished 3 x; ]0 K) J/ ~
while (!Finished) WScript.Sleep(2000); 8 v6 w! \( b9 ^) ?5 r/ \) [4 F" X
# M; @) z3 Q, Bsimple.CloseModel();
: u9 h4 c; {- [% i+ D$ A r' B" psimple.Quit(); 5 L0 A8 u* ~/ {& @' r8 u
WScript.Quit();
0 B5 h1 \* n4 ?2 @! h9 M& H ( C- X0 I' P, D) @: s
& {3 j# E$ Y8 j
function RemoteControl_SimulationFinished() $ P& ~3 |5 q9 J% A& X; [: @& |/ @
{
! D) [, D7 i' l0 _6 O WScript.Echo("Simulation Finished!"); |