Example of a JScript
% H% |- B- `5 {var vbOKCancel = 1;
- z! w2 F. g3 G3 Y0 f* v2 B; cvar vbCancel = 2;
0 L$ C7 O5 ~( \var vbInformation = 64;
/ m% `2 {! ~/ Q, cvar Finished=false;
) _( s6 [. ^& Z: i/ K( M # x9 A6 R! W; A
var WSHShell = new ActiveXObject("WScript.Shell"); 0 S$ i- p( L2 q+ m! C
9 \1 H* M$ H; {% H4 p7 D3 L) {3 t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 i. e& y! B: o4 H% M2 B
8 \ W* k/ K& c8 psimple.SetLicenseType("Runtime"); ' x# m" U6 ~! E; U; O
; k# J* U" ` O4 u; H |+ b/ _try 8 _5 G+ F, R* Z% z
{
4 z u. U. w( m2 c4 Q // Enter the path to a model file!
$ `6 a& R K5 Y8 Q: d7 b* u simple.LoadModel("C:\\Models\\Test.spp");
, D; E6 {9 M* Q9 K' H" [0 T}
* {' \' p/ P5 Q8 J8 xcatch (e) 5 ]& A9 q& ^* q/ ]( M
{
! f' j: |, j: j! w7 k* | WScript.Echo("Could not load Model!");
2 W3 t: V; S7 G* B9 F WScript.Quit(); : I; [, q1 X# D
}
D2 O3 q& Q. Q
9 O; E- K- q# i4 @9 Q5 Otry
* D( h9 w: w% v3 b, H, d; H{
1 Z6 ?5 _6 H. v( a6 U( M" U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 u, C D$ G5 n' K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 }3 [( o/ F' ]7 H2 k if (r == vbCancel) 9 W9 s$ ?) Q: p
{
: O8 C1 c0 {/ v5 {; P# G simple.CloseModel();
1 } i0 ]( @5 X/ X2 G8 t6 v3 } WScript.Quit();
8 \$ t. O- l' A2 T. ~0 X }
: L6 ?6 s0 E$ n% q d: c3 C} * w, Z0 c+ B; q7 g( Y
8 y% X% y- c0 m1 ]
simple.StartSimulation(".Models.Frame.EventController"); 6 ?2 Z1 S7 }3 E% A, ]
1 s1 n T, W" y: D6 M
if (simple.IsSimulationRunning())
) ~: K" o; e ~3 n* ?0 ~ WScript.Echo("Simulation is running!");
3 N! r/ W5 L. X" z5 Y) H + {* |: j: N9 b- e
// Wait until simulation is finished ' ?( R1 r. m d" E
while (!Finished) WScript.Sleep(2000);
8 t8 i% y8 I2 e ) v5 Z% I$ t* f6 g' Z7 k
simple.CloseModel();
$ W1 `$ r" T% b, T0 m o+ I9 Ssimple.Quit(); ( m* p- s) n. o( M0 R& ^
WScript.Quit();
_5 U8 P% s% }0 B6 ]4 b
# y1 D4 s9 J& i) A5 P8 O& P 9 u6 c) A6 R7 P. E7 X( f3 a: k
function RemoteControl_SimulationFinished()
9 [6 Y7 E3 [ Z j+ K{ 6 k/ q( X" V: W/ D
WScript.Echo("Simulation Finished!"); |