Example of a JScript
8 R0 U0 g$ A+ U! M0 |var vbOKCancel = 1; 6 X6 f; S+ R6 g( C; w+ k G
var vbCancel = 2;
0 Z) S9 y+ Z! a/ F+ c( pvar vbInformation = 64; ' n: @" \+ r) P) h2 q
var Finished=false;
- ^+ U# L) a8 _' @1 M& t) U 6 s8 h3 I( Q# ]0 q0 ]$ s: M
var WSHShell = new ActiveXObject("WScript.Shell");
/ h" y4 i/ K4 z+ _0 S, T+ u# @
" P7 Q8 f' r Z# e ~+ T6 wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 _- s8 b2 F/ e# U) D5 v% \
9 I0 Q. E- w% k( r" L0 b: x1 ?
simple.SetLicenseType("Runtime"); 9 W# P6 } c. d) j9 C
, F( A9 x5 n7 d% ^try
1 Z! v' G6 D3 ]+ |, n{
3 _% P8 x$ X9 d // Enter the path to a model file!
" P1 V* w3 F* f' | simple.LoadModel("C:\\Models\\Test.spp"); 9 n: a3 x V+ ? b: t4 ]
} + Q" S: p# d+ o% a, j
catch (e) ' T7 k* ]" e/ E' a
{
% z( [5 g9 P9 R WScript.Echo("Could not load Model!");
x8 N2 F) w2 L/ z Y" N% E WScript.Quit(); ' d+ f4 X' M) I2 Z$ V
}
& U" p7 F# ^9 K- I6 Z/ s
8 r6 O- T" i( ~1 w% g/ etry $ Y M7 m1 o6 w- k2 a9 a+ l/ r
{
, T$ l4 ]7 _. |. {& w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. |# _2 s* U9 f8 O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 |( B3 u9 O2 `, [" L5 t S
if (r == vbCancel) / w% }8 Q( v7 L ]* |8 V, o
{
, x) Y. f$ x$ X3 a- v8 w$ Q0 O simple.CloseModel();
* S- S( r& P; ]5 x WScript.Quit(); L* D( M; t6 t* a' q4 G
} & o9 w0 a9 {, Y' M+ f2 A8 t
}
! ]1 t7 B. k" {! G
! i1 w/ t$ a* L1 w, d9 C0 D$ Osimple.StartSimulation(".Models.Frame.EventController");
2 M. f2 H! l5 [, k* I2 l
* i4 e" ?. O8 J Z* |5 c/ t5 iif (simple.IsSimulationRunning()) . F1 l( D: k% ~( D
WScript.Echo("Simulation is running!"); 3 F1 W$ [: i6 o; O5 s
% x f2 ^) |- ^) R: m! _% N
// Wait until simulation is finished
7 i! ~4 j4 N/ V1 R. J/ xwhile (!Finished) WScript.Sleep(2000); ! Y( p0 F8 c7 u
, M& K' P- j2 _1 Y9 esimple.CloseModel(); 3 `3 Q) S5 j6 ^' \1 |. Q
simple.Quit();
: C! Y$ I! g: _( {2 ~WScript.Quit(); 6 ]2 {3 F- @# ?
4 @) F) z! C6 \: R7 [1 ` @
. U$ l! F9 b% u" h, \function RemoteControl_SimulationFinished() N( [1 N4 |1 w
{ 6 U- c- B2 m* S% S4 A! R, I+ x( I
WScript.Echo("Simulation Finished!"); |