Example of a JScript
2 x' u5 y' N% h* l4 X7 Y! \var vbOKCancel = 1; ; d1 | |$ J; q9 F1 x
var vbCancel = 2;
8 N5 } Q6 @. o" \var vbInformation = 64;
1 @* C7 | _! ]; D. O: rvar Finished=false;
1 [: ], v. A' n5 o7 Z" m # V4 ~! f( I$ U" c' H+ {/ H
var WSHShell = new ActiveXObject("WScript.Shell");
# [! i, {0 Z/ t: n% @- C. k2 u" Y & }% }/ Z( Q) B6 ]4 j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - d4 L r4 F7 O. Y& r
1 o2 w/ t% B. V* rsimple.SetLicenseType("Runtime"); + m$ Q3 [" n, Q. B: A+ H
1 O2 H6 `, p- V9 x# {; N, l
try
( P" ]+ g* w$ M4 ?) h) @{
3 x9 v0 ]! F& f' p) M' j# A // Enter the path to a model file!
& c+ D( J. k3 g1 I$ r4 A- m8 f, s simple.LoadModel("C:\\Models\\Test.spp"); D1 \8 A6 r/ _" Q
}
1 G' X0 W1 C9 Y( k+ O" v( X ?9 ocatch (e)
" `* J& B2 w5 m( N) C{ # ]& \/ {3 Y( \
WScript.Echo("Could not load Model!");
1 g. f2 U* G: } WScript.Quit();
2 H! X" E B. O% w1 j8 |} 4 M! S. L* j& q4 {1 h" g% N
: L+ |9 \# @) f3 |try
w4 H# X2 b2 t0 v' h, l{ ! v& q4 ]2 c( x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! p2 F2 l' m' O$ m1 f: }* R
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% V8 Y( E$ r3 n% `% x$ k3 S2 ] if (r == vbCancel)
; B% H+ N# \5 Z2 I) r8 u$ N4 n {
) t6 A. {1 I$ }& Y" l& U simple.CloseModel(); ! f* ^! ^( O4 v& j7 M' T# Y2 {1 [
WScript.Quit(); ' [3 v e. W9 Z# W/ W2 o& l0 p
}
! l, u d6 Y: l9 P} 5 Q8 m0 n! G& f! a8 o) t; y7 h* @
$ ?) h: L# P6 q6 s) o! S% i! g
simple.StartSimulation(".Models.Frame.EventController"); 8 y% u, C R( P/ w5 e6 ^9 p
4 o6 U+ \/ Q9 U# b% C" L4 f
if (simple.IsSimulationRunning())
. U: \1 L' ?; u8 H8 t% L WScript.Echo("Simulation is running!");
6 {/ M, A, b7 Z T C- t7 H / W Z0 C* C. B/ }4 R
// Wait until simulation is finished + f' |; F3 H$ v. F, o! [8 [+ {
while (!Finished) WScript.Sleep(2000); 1 F; d. L* c3 i1 [* V
3 D$ _& t3 W% W2 rsimple.CloseModel();
6 Y9 s. `: ]5 `# h& asimple.Quit(); ; H+ d* W4 f! {4 V; q5 O5 I n& n
WScript.Quit(); ; i: `' L! |# v2 p2 ^/ c0 H
" d$ f, c7 B r+ j
' \. s: q* f* k: E' |, z& b# V& l: |
function RemoteControl_SimulationFinished()
$ _+ q% e) O! I. B2 w( q2 c `{ I( ~8 u1 t% _- v8 M; T
WScript.Echo("Simulation Finished!"); |