Example of a JScript
6 U+ C# a1 k/ Q7 I- b3 w* {: gvar vbOKCancel = 1; $ c, `! t4 g* [) A& t$ Z
var vbCancel = 2;
3 T W* {/ ?4 ]+ p, E8 t+ Uvar vbInformation = 64;
' N- U7 i2 ~' W! F, ovar Finished=false; 9 _ v& |9 H$ }! o& }9 q
7 L. G1 t8 T, M+ f# j8 |var WSHShell = new ActiveXObject("WScript.Shell"); $ F0 l0 t# L, V2 c2 x" F. L% B
$ |) h" Y2 o( B9 H9 X! |: h& Q$ D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / h7 ]. U4 h% |1 e9 k$ t
- y$ x0 |1 M, d9 m3 C! \2 D
simple.SetLicenseType("Runtime");
% t2 o- ~: ]1 e% U9 o3 T% a# o9 b) j
. Z. ?) C+ R- \* d! k; xtry
% |( r( v( n/ \/ w' R{
3 K3 t& |4 \6 F) S a \( H // Enter the path to a model file! 0 g2 W) H( u/ D3 F, H% x
simple.LoadModel("C:\\Models\\Test.spp"); 7 Z* T2 J, ]4 A
}
* c6 m9 ?* I( u( K# Ucatch (e)
4 k5 w$ w2 J% k5 ]; S( x* l* r* M( R{
* q% w# B5 ]. e( R WScript.Echo("Could not load Model!");
- Z- [1 H; {' e* A" |/ q6 m WScript.Quit();
7 K: o3 S1 n( Y: N9 s! D} 4 C. M5 b- k1 Z
7 c6 |* }. N7 N) M1 Utry 5 I$ j8 A; f I
{
( O: P* x' f; E# A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 ?& o6 m4 o7 i2 r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, E- X$ ]5 k1 c, q+ F6 V3 q if (r == vbCancel) C, h5 w) f" A
{ ( F9 D# A' K6 V/ [" j% ^% T
simple.CloseModel(); # r% p9 \& a' o4 B, `& O: B
WScript.Quit(); 2 w( d7 [8 p. M
} : j0 B4 a- Y- A3 |! o2 t4 d/ F. _6 m
} % V1 Z( W4 d: X# d. u) Y% q
7 `$ k/ l, e) W" h* P# d
simple.StartSimulation(".Models.Frame.EventController"); ' h4 _% x# N5 D$ K# m
% R+ s) X; t7 P1 Aif (simple.IsSimulationRunning()) / [4 b' |$ }: d' ]3 P5 l
WScript.Echo("Simulation is running!");
, o5 l3 K, e0 H
+ z3 o+ }3 F5 Q, ~1 a5 }5 ^1 d// Wait until simulation is finished ! h- N- H/ c+ H$ A0 ^. \
while (!Finished) WScript.Sleep(2000);
8 j! {) h7 H$ y+ h5 X% M5 P
+ C! @; N& N4 tsimple.CloseModel();
! x- Q9 I2 P- |7 ~4 h% usimple.Quit();
" U, J/ {( a1 [+ W0 Q& DWScript.Quit(); ' X! l* J* V0 v z% O: n
$ W0 u g) w, [( w, v
: V. K9 L: p' L1 r
function RemoteControl_SimulationFinished() , \' ]& U! A6 h0 z$ T) ~, c7 s% R
{
5 F! A8 P# f+ Y, n6 \" U7 A8 Q WScript.Echo("Simulation Finished!"); |