Example of a JScript
- v- R( S5 a# H& F/ a3 e" Nvar vbOKCancel = 1; . F) h" N7 x n
var vbCancel = 2;
( V! F! }, q9 |5 {+ S. Jvar vbInformation = 64; * B0 u6 r, r' f; q# l
var Finished=false;
6 @( J* o* a& M5 t + U2 d; m6 X G4 o9 ?
var WSHShell = new ActiveXObject("WScript.Shell"); / a7 V; L& n+ M( S
$ g! K+ _ g5 ?* ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; J6 f2 s+ F$ t ! B; [4 M# j6 I9 x4 ?' W7 g; I
simple.SetLicenseType("Runtime"); f3 W$ b. }5 | [. L* r
% _* h$ F: O2 p* d
try o7 s& |! F) D4 u m( ^
{
, [: O6 K X# [3 R& B // Enter the path to a model file! * A6 P, o6 }0 S6 ?4 _
simple.LoadModel("C:\\Models\\Test.spp"); + f( m( E* Q( i0 {
}
0 B* u# m( e/ P/ |- Scatch (e) 0 t& ]! B: P5 n( t; K
{
' |+ X1 Z n6 v# p! U WScript.Echo("Could not load Model!"); ) _2 V" y$ B: _8 |1 Y) ^
WScript.Quit(); \4 ^+ d4 M' k1 |1 e! @! j
} " _ T b5 i s( O4 y, Y/ P; I: r* J
0 I# B- k- y9 S# Gtry
- y( W. g# _7 i0 A0 c{ e9 ^# `3 w4 m! f6 `% f
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( M. B' p4 O$ T9 x3 L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # k' a' e- @4 e8 L' K* k: q
if (r == vbCancel)
" k9 r2 v4 j$ n/ y { / g2 Y" I/ K$ M# Z6 N* l; `1 @
simple.CloseModel();
2 p; W3 y$ r, @9 P5 \/ Y WScript.Quit(); 2 s- x8 ~% W! g \' N6 T
} ; F8 J) l+ Y6 }$ Z) n
}
t, C. y" ^6 W7 l0 }! V
e" y' l+ b8 V5 L, P7 d7 |simple.StartSimulation(".Models.Frame.EventController"); 4 Z) f, J+ l# w$ j2 G3 @, Q' ~+ M
5 U7 t1 \! z6 [- G
if (simple.IsSimulationRunning())
, S( m8 q5 y; b. p WScript.Echo("Simulation is running!"); ' r ?+ i- A: m, E
B; D' J$ S. g) E9 Z& d7 ^
// Wait until simulation is finished . e# L$ o6 t+ @( U/ g- T: G, F
while (!Finished) WScript.Sleep(2000);
1 b0 y% @8 D6 K$ _# T: G5 L7 b + }2 g# J" C5 r [% E
simple.CloseModel(); 6 \& o! {# |5 Q3 C( i5 C7 @
simple.Quit();
# x3 z6 L" h8 @* C wWScript.Quit(); ( m9 R& k& S) w/ Y9 H) N; E$ c
: x& {4 k5 U: J& b 9 `" _; b7 i# a0 ?$ i
function RemoteControl_SimulationFinished() % `$ ~+ p7 t& W- U# p
{
* k9 o* m1 ^5 ?" J WScript.Echo("Simulation Finished!"); |