Example of a JScript
S4 c) `# ~' B3 K, ^) f' Cvar vbOKCancel = 1;
# C, O0 u' g* K6 Avar vbCancel = 2;
$ y+ _0 R Y4 t8 h, `7 }) {var vbInformation = 64; * [' z! W8 ~8 i
var Finished=false;
+ R9 G% N( [: L( ? R: f& ? T ! A/ m: ^/ X" m: f# J! ?, V9 h
var WSHShell = new ActiveXObject("WScript.Shell"); 3 `, C6 _, |9 U" a/ Y
, d7 }7 I$ {7 k: q" jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ Y2 K; X- z2 `0 ^) F
3 `; A1 v& A2 e, nsimple.SetLicenseType("Runtime"); $ T c, `7 p* X- U {3 `
& P# |3 [ K% X/ Z% Z
try . |5 p! O5 }" E% }' i* t
{
6 I( W, q5 w0 k$ } // Enter the path to a model file!
* P7 ~( V( e: ] simple.LoadModel("C:\\Models\\Test.spp");
; _& y0 J h+ Z( H( d2 g}
, u) M2 {% ?% m/ Ccatch (e) 0 E% L, s: J0 ^6 y5 R9 y3 J8 @& b
{
5 h' i; x& h, A0 G V WScript.Echo("Could not load Model!");
/ q7 G% S- i7 S3 ^$ s& d9 F D0 a2 h WScript.Quit();
& F9 q# b% e7 R3 y- m}
' Z p. f# d0 L+ P# d 2 @5 j- U$ _+ w) m2 k, N
try
' q4 Q- @# g1 [3 i{ * C- M( @* g" `3 e2 ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, V4 ]7 i2 t( _% w0 c I+ q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' x& `9 i& w. n; z if (r == vbCancel) 7 U3 y- h4 K# [5 t( U L
{
6 e: W7 M% Z( ` simple.CloseModel(); - u) f, j6 L' l/ p+ v/ @$ d
WScript.Quit(); 0 i( z+ C2 } I( B6 v- `
} 2 y4 z0 e/ X) V" ?- g/ \
} ' L9 T8 l# [7 O# ~8 M8 J4 u
" x0 q5 t* q* l4 B8 Z8 t# V
simple.StartSimulation(".Models.Frame.EventController");
/ S8 T9 C5 U- i1 k* G3 a, j0 c
3 a) O+ W) d I4 Tif (simple.IsSimulationRunning())
, h, } H( v+ {, T! d# _ WScript.Echo("Simulation is running!"); 0 w! w4 _! ~0 {7 F5 J' n
) [' a2 Y! s9 l7 Y- x
// Wait until simulation is finished
3 g1 X7 V. L0 h( ewhile (!Finished) WScript.Sleep(2000); % i( F4 q7 m2 d( _. M; L1 u- T C
p( k. U1 ]" e6 H% \/ S
simple.CloseModel();
6 f; D- I+ i) q' G1 L% o7 jsimple.Quit(); * i9 G( g7 l8 r" j+ X& K j- R
WScript.Quit();
! k- Z; a; ?' X( T3 A" `
4 _0 e8 v5 [: u6 R5 g
- @: S7 t, |5 a1 Ffunction RemoteControl_SimulationFinished() . Q& p% ?1 T' ~4 p. ?
{
K( v- |9 {% V7 B9 U4 ^7 P/ F, t0 V WScript.Echo("Simulation Finished!"); |