Example of a JScript $ H4 b. }$ ?6 z/ \9 u
var vbOKCancel = 1; 6 V. `- X. G8 v ~
var vbCancel = 2; ! H+ g- s) @: b+ E( A# V' J
var vbInformation = 64; 5 I- K$ i& T: G8 d
var Finished=false; 1 b& `4 f3 [) a7 s
/ M6 t0 o* |: N. f/ [. Z
var WSHShell = new ActiveXObject("WScript.Shell"); & `, h& Y0 ]) ?0 O" p# A
: K6 R4 F/ J& \; I8 M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % z `) o P. I& K
& _9 _, f# Y H" E1 i1 X
simple.SetLicenseType("Runtime"); * [) R% b# ?7 j+ k5 R S3 a
* i- B7 s1 l- X- D& r% k, P
try
! v% \5 N, u2 q" b{ 6 c4 l0 h/ x$ m3 ~: x! x( Y
// Enter the path to a model file!
5 q& ]) S& x" u4 G# T# ? simple.LoadModel("C:\\Models\\Test.spp");
" f1 Y* f& i2 d1 x}
- }; T& b; o8 E1 _1 U- S( lcatch (e) 6 J, p' ?: f: s- }6 e% C- x( C
{
0 p5 V9 ?8 k: v, p/ T1 [/ Y" I WScript.Echo("Could not load Model!"); 5 y; g2 L5 N9 p
WScript.Quit();
1 H( }# ~+ R F" Z; s# F# b} 9 e( c7 b" s6 i/ `
6 e y5 P/ g$ Htry
. A! w7 d0 q0 Z! G. R& h2 T{ , u" @! g1 W l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # Z+ E1 i% w* W2 q) T- j5 X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 F7 H7 L9 b! B0 `9 L/ x, b* d0 t, @
if (r == vbCancel)
. t5 @( W1 t& O2 i& q, w {
: V" I4 J# j6 l" g/ @) @3 n% R! F simple.CloseModel(); ( X1 D7 ?" n. q' c
WScript.Quit();
5 g% T6 U; D, b0 _" v } " l" B! z4 h8 F0 \3 V% w
} # y7 u; d& C: k& x' X
* i7 Q3 O9 Y8 R/ x, A- j6 P8 ~
simple.StartSimulation(".Models.Frame.EventController"); 8 d9 ?! y$ e: f: Y! M
2 T# e# a+ R, h& k+ C
if (simple.IsSimulationRunning()) ! k9 o ^+ d9 _1 f( h0 `
WScript.Echo("Simulation is running!"); + G* }4 c7 g& }, k
! g3 N7 T' w/ f0 q& I! X/ x0 d
// Wait until simulation is finished * _+ z% C; u! q; h( r
while (!Finished) WScript.Sleep(2000);
( u; r5 ?/ U; _ 8 |6 G# s' K; k- ?4 ~& F. w7 x3 z
simple.CloseModel();
% w0 n( j' {" K4 j, P8 C5 _simple.Quit(); $ W. j% b& U; r( i% A
WScript.Quit();
8 u6 T+ V! ~# B+ W) J5 c0 v 0 t3 `, l1 |1 b# z X. z% M9 u3 O
# e4 `' d, Y! Q1 C2 V5 zfunction RemoteControl_SimulationFinished() 1 ~7 [7 f* c- ]2 |4 y& X( p
{ 3 A2 L8 m) ^- X: W
WScript.Echo("Simulation Finished!"); |