Example of a JScript / v, S b" _: q% F, i0 G
var vbOKCancel = 1;
$ `2 n; ~- o$ F2 x( c0 Tvar vbCancel = 2; . g% u ~# S2 n$ f" c. }7 \
var vbInformation = 64; - g e7 |. [& w+ E. T
var Finished=false; , s$ Z j/ j8 G1 K1 v; J9 z, f
7 _5 b7 P ^; a& K+ [3 v! Qvar WSHShell = new ActiveXObject("WScript.Shell");
& G' \4 `6 x p$ |0 {4 [
# ^% M: M# H% C6 z$ ?; @# u+ fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: m% F4 m O1 u; S- k. ` + {% [. x" I! H1 P0 y. x4 v
simple.SetLicenseType("Runtime");
* P* R/ x" Y4 N3 D 1 k' m; T% S1 |8 P
try 8 D4 P$ w' k( X
{
. M) B: q# X0 }9 m/ U- J // Enter the path to a model file! , J7 `8 g U: e6 J* ~2 O; C
simple.LoadModel("C:\\Models\\Test.spp"); 9 N) G% S: a: g/ |' ~, T. w
} ( ]: ?2 \, `! ]$ i' u* Z
catch (e) + ~7 m- Q1 f! K* v
{ ( | o3 V! {2 d% @/ X
WScript.Echo("Could not load Model!");
7 K+ |6 f, K- Z4 T: Y WScript.Quit(); : a; e L7 m! ~# h( C% ?
}
/ g. J) h; Q7 S/ p `1 q: S: ]6 ?+ m$ o
' p/ |: ^- Z/ N' ]4 C: E- Dtry * C( y7 s; q3 a
{ . P' a3 h8 o$ w
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 ^# | ?1 Q* K3 p4 r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 C* U, H3 D1 ^8 ^$ H8 m) I
if (r == vbCancel) " a9 q. _/ C5 t# Z: p* m
{ 8 V1 z. Q, X T* [
simple.CloseModel(); & o2 c3 \* e0 Q8 S
WScript.Quit();
& e/ E% N& C" O) M* Q) v: f1 F }
& R& X" s1 L' B0 d: [( }8 D2 m}
/ ?* @0 A) H6 c9 _ . {2 A7 A# k( m: c
simple.StartSimulation(".Models.Frame.EventController"); 2 Y/ W5 x& o* I! B+ ^+ {
! @2 m8 t2 Q& N+ ?0 v# Bif (simple.IsSimulationRunning()) ' m; L9 q" Q$ n, V, x4 f) }0 V
WScript.Echo("Simulation is running!");
' |) k$ _4 p o: u6 L
' G! n; H+ b( u- l3 p* ^; `// Wait until simulation is finished ' F; i3 p2 W; ?6 i; Y7 L) E
while (!Finished) WScript.Sleep(2000);
) B$ r7 Y6 Q' Q$ D. p $ a- H" F: V6 t9 T- W$ M* R F3 x
simple.CloseModel(); % d. I9 B/ W5 p3 t
simple.Quit(); : ?6 `6 i" L6 x) X2 q% W& E
WScript.Quit();
, Y2 O: P$ c2 l+ W # r9 D) I+ I0 q9 S
; x, \- ?2 y7 i4 Ifunction RemoteControl_SimulationFinished() 1 C$ U4 S9 f! V% `5 t; |
{
# O1 J( l* W1 F WScript.Echo("Simulation Finished!"); |