Example of a JScript ! f3 y$ h3 J; d, ~" W
var vbOKCancel = 1; 2 P* d/ w8 d5 Z
var vbCancel = 2;
: g0 P( i0 l$ }! r( Bvar vbInformation = 64; " E6 f- S+ J" t( Y- T
var Finished=false;
Q0 s8 e) s+ D' w * A" {4 P& ]; I: V U
var WSHShell = new ActiveXObject("WScript.Shell");
8 ~) A0 Q. Y3 \
( D! O: h) f, r. L+ ^, Avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * e" ^ Q* M/ w6 c
% B& \$ X9 Q( {% _# J& |6 rsimple.SetLicenseType("Runtime"); - p% G4 Y% D- u, c, u% r
& @' A' I8 v; p: a
try 7 y# l: x1 y( ^" t% _
{ - `3 i* T+ o6 W6 B
// Enter the path to a model file! $ L- ~, ~* I4 X
simple.LoadModel("C:\\Models\\Test.spp"); 4 G# G! V8 |4 k* p! B/ }, f
}
) ?, J m; ~2 e3 o+ u, l) Qcatch (e)
& R& q" e8 Y, W6 C( u{ $ i% z) X5 I" Z: Y
WScript.Echo("Could not load Model!"); * q) F) I$ g: H ?& ~# A( e: D
WScript.Quit();
% U) ~! |8 l7 w} % j6 w: ^$ S+ C- B8 _
- e; D+ U, J( _! o, |
try
7 n/ g, i5 [$ J2 ]1 ?' t x2 ^{
c9 x; W4 O. i- W4 _0 v; {, D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 @1 _$ |; V! r: E {. R. ]3 ]; a
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); O8 P* C9 Z9 X3 H9 q
if (r == vbCancel)
8 x% b5 M( s; } { 4 q, Z, n% d$ x& h# C. L2 h. L. b* ^
simple.CloseModel();
( P3 p ]0 S$ X8 Y$ } WScript.Quit();
) W/ a+ p& a- Z1 ] }
) s3 z; Y$ t5 V* h}
! O) [2 O2 v: x% q . D4 p% ?4 A4 b; G+ E3 l5 ^. d% |
simple.StartSimulation(".Models.Frame.EventController");
7 `2 U% x" z3 a. A 4 h$ [1 Z6 Y/ b0 p# M* @, i
if (simple.IsSimulationRunning()) ! k3 o5 S+ B& C% ?" c( s" `
WScript.Echo("Simulation is running!");
! r1 P4 p8 ]/ d% f; t
1 `) d. @5 ^8 E( V// Wait until simulation is finished
0 `6 k6 d3 a" N8 d: _2 [, Cwhile (!Finished) WScript.Sleep(2000); + Q' A, B2 E$ ~/ r5 P9 O ^; Y
8 x: G3 g3 T! r# _
simple.CloseModel(); 1 Q7 c$ a Z: S* t6 y' C. P
simple.Quit(); / B& X/ I& ?3 ]
WScript.Quit();
* F' @# @+ o" Y* Y3 ?
! F3 U5 ^4 S+ L1 V; f2 F5 v + u1 c) _% u9 r5 x# I5 M3 y# `0 R) l
function RemoteControl_SimulationFinished() 9 _% ~! `5 ?6 |7 m, |7 ~6 o
{
: U' T5 L9 t7 [. ?5 i. P0 L# `+ f WScript.Echo("Simulation Finished!"); |