Example of a JScript 7 ~; e8 H$ H( U) V. t1 f
var vbOKCancel = 1; 5 r( B5 O# J! f
var vbCancel = 2;
5 o9 Q3 U. y# ^var vbInformation = 64;
( h9 @0 h+ h2 B9 y4 w0 hvar Finished=false;
; H- ~* U7 l$ \' p' O % I. o3 c6 {' B5 b7 Q6 e
var WSHShell = new ActiveXObject("WScript.Shell");
. g: Z- ^, R6 O( k1 w- v* a
: `9 a7 q# v. Q, o5 J' rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 x$ @% I9 |* b4 C% x# y
# w O6 `% @. L: C& [simple.SetLicenseType("Runtime"); 4 q6 d u C( S' Q% V
' H R; F5 n otry
$ s% F9 E, z3 ]1 B4 i B8 `{
, c5 ^8 n* i% F, c // Enter the path to a model file!
% m/ z3 w7 u6 l# t: q9 b, z- E simple.LoadModel("C:\\Models\\Test.spp"); 0 ~' ^, c& c) X$ h# I0 m
} 1 \% v4 \5 H' }- z9 ?" ?; |4 B) i
catch (e) - I7 K/ A1 s$ N b/ L
{
& j! s9 `, K+ l WScript.Echo("Could not load Model!");
5 K/ `" v- C( L+ Q& w WScript.Quit(); 9 R* m5 a9 \& {+ b
}
F- G; D/ p/ ~/ J
6 u3 D" _) z6 ~try ( V' ]4 ~6 F. `, N5 k Y {2 D+ Y
{
; K' Y8 Y0 u- G* y+ I/ r simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" \1 P' T2 a+ t' n { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; w8 r' b4 ~! E- i
if (r == vbCancel) 3 `& t/ ]& L, b) C
{
4 w' Q1 p2 ?) x simple.CloseModel(); 7 |7 X1 _" B, d: [
WScript.Quit(); 4 o' ]% D' ^* w7 s+ \+ { i
} ; K) S6 r1 |" j' {
}
1 O; `* c& K2 c! F. R , k7 Q+ s6 Z3 X& H
simple.StartSimulation(".Models.Frame.EventController");
, [; K1 q/ r0 c6 T' I D1 d4 E ' X) s A! w/ O6 h4 ]
if (simple.IsSimulationRunning())
4 U+ k$ z3 p# {9 `' I6 K- N WScript.Echo("Simulation is running!"); + S( B6 _; ?0 C3 b
% j' V2 K1 ~+ i0 N% g8 p* ^
// Wait until simulation is finished ! A- N$ v9 w# c
while (!Finished) WScript.Sleep(2000);
, U( ?' ]( j: i. H+ o" f ; u9 u5 I9 Y# M" Q9 r* O5 k
simple.CloseModel();
. Q: w! s7 \* i( F9 w2 Bsimple.Quit();
) f8 @4 q( D' R _2 dWScript.Quit();
7 Q( P8 V7 i7 ^% Q4 O+ W2 r0 r
( P P0 B: U$ Q* e 3 v. V( B$ Q. \" w) P5 V
function RemoteControl_SimulationFinished() 7 E- _: l% H' b
{ 5 @2 S& d( r% ]! W2 |
WScript.Echo("Simulation Finished!"); |