Example of a JScript & \- l: V- n: g: \
var vbOKCancel = 1;
0 @" K6 f; l- L. p1 r! s5 Qvar vbCancel = 2; , }) X, W! h& O+ N# c7 b0 w
var vbInformation = 64;
2 _7 Y0 f+ ^: K6 Mvar Finished=false; 8 u" _1 p+ t3 h
* l( m# v, x: R* Cvar WSHShell = new ActiveXObject("WScript.Shell");
6 v8 M3 V; y, k1 a; f
) d7 D8 _6 w) M) ? v! o7 uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( `+ x6 G/ u8 e! Z) c& D
" Y% n0 u# y" zsimple.SetLicenseType("Runtime"); : b0 L5 Y* x) T' O) } ~
0 }+ @5 k1 Z5 c( p& c. z
try . o7 d' y* n6 @/ S! }' \
{ & g! U: z$ G! z9 d3 ^0 I7 j3 F# K
// Enter the path to a model file! - m' Y1 S% S4 w7 w9 P! {0 w! u
simple.LoadModel("C:\\Models\\Test.spp");
1 j9 ?5 b7 h3 b0 w} 4 h: S( N$ W$ `$ i5 r
catch (e) X$ b4 b1 Q$ g& g( z
{ ) u" \/ h @& @
WScript.Echo("Could not load Model!");
5 d" H- x$ r; m9 ~ WScript.Quit(); " k. U: S# r& D& x
}
* X3 H+ _( E/ l- M( c; k2 G8 P S! |$ i+ ~- T+ a$ V
try
" k6 ~: s/ ^" K! n7 T{
9 F6 b7 c6 H3 G! P8 |& X4 { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) k$ u# b" B( m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( o2 p3 _7 t2 G" Y+ J9 m7 n1 z if (r == vbCancel)
{# ^. Y3 ]3 D( L { ! |: X q; p2 ~) I
simple.CloseModel();
0 D- P$ N( C7 q8 ` WScript.Quit(); . W7 [, n6 i! B: j
} $ w2 @4 P( L* j" O2 ^
}
" P* M) T* B* x: I+ u7 L: n) [7 W " {7 ^5 Q9 h) p7 F: ~( m" S
simple.StartSimulation(".Models.Frame.EventController"); , h `6 c/ I' `
) t6 e+ e- l# P! Y( W, ~: w) k
if (simple.IsSimulationRunning())
+ h9 T) X+ Q4 ?' U$ W: { WScript.Echo("Simulation is running!"); ) r ^4 V u+ l7 u. a8 {6 Y+ m
* D6 a0 T. [' @, ^! \5 {// Wait until simulation is finished
9 I4 g1 @+ |( u) t; Y& Owhile (!Finished) WScript.Sleep(2000);
/ S1 x* P9 O( E) C; _
: c9 T6 v7 [8 P9 c' `2 v( p, x ^7 hsimple.CloseModel(); ! n! H$ A/ r# S
simple.Quit();
0 P$ A# o* U6 i( [- A8 a7 IWScript.Quit(); ' S/ S: ^3 t5 m
1 s; A/ }3 D0 R
5 h8 |: P6 R: O# S3 z3 Gfunction RemoteControl_SimulationFinished()
! b0 y- _1 J o& @: I{
$ D' B$ U8 k% ? WScript.Echo("Simulation Finished!"); |