Example of a JScript
$ l/ h0 r' V, |' F# Q) Q5 v* zvar vbOKCancel = 1; ) w! G0 q( n$ I2 |! W# I
var vbCancel = 2;
4 N* o( l# N+ n3 M& v) zvar vbInformation = 64;
+ X8 l: ^# w0 I! S5 C" }( O2 X( hvar Finished=false; R# r9 |4 N2 ]8 D; G4 `* C
6 U, t; h' U( nvar WSHShell = new ActiveXObject("WScript.Shell");
+ U5 O$ K9 E" E! n$ j, F
( p/ b$ n# R) ~8 K/ Kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 ~6 m4 e! j1 B* @8 a # t; _. s3 Y( R1 E( e
simple.SetLicenseType("Runtime");
4 o" H% O- S& S |$ Z0 S
2 g# U2 E3 u# p: J% B4 V8 ttry
. i8 G6 i4 {* m& D( E& u{
+ K! x4 @( _( Q // Enter the path to a model file! " d$ ?+ W6 `% B
simple.LoadModel("C:\\Models\\Test.spp");
7 x# S, |* A1 M$ v0 G2 N}
" k7 f* Q+ a- lcatch (e)
- P* |' {4 |. v$ f% ?( m' \{
+ x- J C0 d7 V1 i' i2 o WScript.Echo("Could not load Model!"); # h$ y# y1 H+ J( y) q! i
WScript.Quit();
& u% a4 v7 Y+ {; u8 j} % r0 g! ~) e6 |
4 p9 {8 k, Z j5 Wtry 2 X& c7 h1 H. Y0 h' v0 R
{ , B* F' j, O3 I* }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 M+ _ w! t. x/ f: `) B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, M6 D) b( Z3 x2 N: { if (r == vbCancel) . p( S1 I8 H& b* X( n$ W
{ 6 P; n* F$ g, s [, B
simple.CloseModel(); : \& W8 _' m$ ]* J6 i" Q5 R
WScript.Quit(); 5 g/ j/ C6 g% {% ]- e8 i
}
6 U- p* d; E; z+ S( ]! B} - i) y/ L; v4 y/ [* x
) @0 E7 ] }; ^' }$ @) m8 `; _simple.StartSimulation(".Models.Frame.EventController"); 7 v* M0 o% y$ g+ j; N
7 f* @1 g: b1 H- n8 k9 M, M8 S
if (simple.IsSimulationRunning()) : ]. x8 H3 l% u6 V) w) h1 r, m
WScript.Echo("Simulation is running!");
- K+ N7 ^& B4 Q4 Y" I8 u: h0 c
) {' Q/ n! f& T: M7 r# Z h- K// Wait until simulation is finished 5 L" g& T! n* r4 F/ E: f
while (!Finished) WScript.Sleep(2000);
+ f; D" Z+ k- p( T2 v, a ' |1 {/ \3 A7 N
simple.CloseModel(); / z& l! K) t) e9 y2 u0 ^
simple.Quit();
; _* A9 w2 y7 [7 x8 j3 cWScript.Quit(); $ G9 _+ J. h" ?; E9 z; X: g6 p- }% i
" s( t2 X+ I5 q
2 X* D+ A. t8 E4 I8 [9 i, {
function RemoteControl_SimulationFinished() + }3 b1 J: J" }& ~1 g( e
{
3 n# ^4 }! O2 A5 {! R4 B- C WScript.Echo("Simulation Finished!"); |