Example of a JScript
8 _% w% u! L8 o, I; cvar vbOKCancel = 1; 6 R4 s0 q9 d# l% z. e
var vbCancel = 2; ! w' {* x; P0 ~& `
var vbInformation = 64; . i+ i1 C1 b* L% R' Q- p8 a+ [
var Finished=false;
8 D6 x5 B7 c3 D% D* x 3 c9 t* o+ I% @1 ~) `
var WSHShell = new ActiveXObject("WScript.Shell"); + B, b0 s! c: I/ p) Q' Z
5 ?# \) o7 l# Y. @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 G- E/ P. `+ j# O5 d1 f
2 [% e0 S, Q3 V
simple.SetLicenseType("Runtime"); - _! C5 m a! T3 G3 Q" m; ~
s& B% `! {) ^: ] s
try
3 \1 p' ~3 W5 w{ 0 a- c) F5 Y- S9 Z) E
// Enter the path to a model file! . {% s% ^4 _6 A# {5 |+ F: T
simple.LoadModel("C:\\Models\\Test.spp");
* n. b& A: A. g- C; A" o; h}
$ @/ ^/ }4 Y# l# s4 _catch (e)
. z0 O% J0 P5 F$ T8 {{ / e+ P* i1 A4 a1 a5 v* M) {* O
WScript.Echo("Could not load Model!"); 8 C: H8 o" Z" m3 d" S6 c
WScript.Quit();
4 w: p( V6 A7 N/ @# `} 9 v: B; }3 {0 }% G: S' G! a5 c; F
/ ?( `+ G, c! X# _1 [# Q2 j/ U7 ?
try
# W6 B0 U7 P( Y' h# c! T% O; j{ 7 U- S1 h" L& d6 s. s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 g; t( e* p& b' g6 ^3 Y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) q) p5 S! [) _8 r& P6 E' ^( l6 b' L
if (r == vbCancel) - w' u9 `3 q6 y
{
2 a. s. p7 W) Q' f$ e% G) j simple.CloseModel();
6 B* r+ K8 n' M7 r3 Q+ R WScript.Quit();
) G1 {6 W# \& ]% ~- X }
4 T: _, i% X9 P( }- L; K4 K}
, [+ @( O( J' d9 [" d
& H: y1 h& d9 X$ r0 Qsimple.StartSimulation(".Models.Frame.EventController"); " g3 {& ]/ T1 `3 g( r3 y
( L- b/ y% `6 R( M- l9 [$ rif (simple.IsSimulationRunning()) , ^, ~9 u2 ?1 s
WScript.Echo("Simulation is running!"); 8 F7 q s/ z* a* P6 Q
* g; l4 y! }$ I3 V5 u// Wait until simulation is finished 0 N t- x; a$ |/ b4 |$ E" l
while (!Finished) WScript.Sleep(2000);
7 N) R9 z8 d- q; o0 S! `
. J4 \1 T z4 U6 Y. K: B1 R3 y- Wsimple.CloseModel(); : ~* M. w" W0 d& V# z
simple.Quit();
( j% P; T" [1 e. c/ LWScript.Quit(); 2 J- D0 C2 v9 D% J- ^, b- K. u# ]
9 Y, L: P/ }0 m4 p
& F( k/ V# g2 \function RemoteControl_SimulationFinished()
8 t$ q) s. `0 r) e, r+ I{
) Z. P& i2 O/ l7 V6 O. e* ] WScript.Echo("Simulation Finished!"); |