Example of a JScript
9 }$ m5 S ^) g; A' M3 V D2 rvar vbOKCancel = 1; % D( e, [4 w* E4 _; o
var vbCancel = 2; 1 g0 v. d6 K) S. q- W: U% P5 x; k
var vbInformation = 64; , _5 R; M: P! J
var Finished=false; 1 j: G1 j- a, V/ {% B* C" t& u
) b# |% z N6 O% Z
var WSHShell = new ActiveXObject("WScript.Shell"); 7 N; f$ ]. B0 E
: n9 ?, z# U5 i( y5 ]; Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , w+ _' E1 L- h- \
3 [5 l+ i" ^. R4 P9 ksimple.SetLicenseType("Runtime");
# P! y3 n" i3 B! I' V
) M: q8 N5 J" r& [1 K) T u0 Ytry & |+ D) s+ m. M0 n0 j9 U; u
{ . J2 E) }' h, \8 S* W. `6 [
// Enter the path to a model file!
! `$ u' _. A% y7 S! E* R simple.LoadModel("C:\\Models\\Test.spp");
. p' R' W7 Y0 G3 i6 B( V}
]8 }8 d" \ q' m" W, G$ mcatch (e) ! |! e8 _( F& z4 P0 @4 g q) U
{
* M0 {, M) R! P" [0 D( ^) l WScript.Echo("Could not load Model!");
+ K E9 G( @" g0 f( @8 q% }# z WScript.Quit();
% T. w( E5 v0 ^8 ?: [" f2 ^}
# I( { a" F1 \5 @: R1 e
. a+ O- G$ Q* J! v4 f7 {try
$ d1 ^- r6 V1 _ m, H, D, [9 }{
1 m! ^, Z. J9 v2 G- g6 O/ e simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 |/ s* _3 q+ L. K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- x4 g9 l5 J+ H- y1 P J if (r == vbCancel) 1 P2 l0 @3 R7 y4 J
{ / W9 M& w8 q+ g% X
simple.CloseModel();
4 [7 c; ~5 E' {4 u WScript.Quit();
% [1 i7 V& X/ P% Y; [, n }
9 Z+ @2 y+ R( s. R% v* s/ k} & J; H7 O; e3 ]" k' c- _
9 M( b; e+ v) H% K
simple.StartSimulation(".Models.Frame.EventController"); 5 n L7 \5 b0 `4 v: j5 S
5 t+ `% y/ g- G: ?: zif (simple.IsSimulationRunning())
1 H5 T* G) P4 c% { WScript.Echo("Simulation is running!"); ) Q& H/ G% U& ?% ?2 q4 {: C( g
. K+ D3 C/ ]6 |. s
// Wait until simulation is finished
+ O5 p b8 ^6 A# x' y3 O5 @7 Kwhile (!Finished) WScript.Sleep(2000); : E- O% G a, r! p4 m! Q3 ^5 I3 @
7 _- ]% r# M& S. J1 Bsimple.CloseModel(); 5 L( V1 ?. |. C3 `: e2 s: P
simple.Quit(); ) M& f3 @0 d- p4 Y( e% h8 ]0 i) m
WScript.Quit();
3 \4 W# K f& s. B 5 A) C( \& f$ K! K$ a1 [0 d
( |+ A [. \+ [3 Ofunction RemoteControl_SimulationFinished() & D% ]% K" Z4 A# t+ G$ \
{
& U6 ^- v: U Z. z9 z/ w WScript.Echo("Simulation Finished!"); |