Example of a JScript
9 ~: J$ l( D! j0 svar vbOKCancel = 1; . j E' z3 V1 `7 C$ @
var vbCancel = 2;
3 x# ~; M; N8 @# U/ {! x8 j4 [5 Wvar vbInformation = 64;
2 `+ p0 j0 J9 ?" j: zvar Finished=false; ) B4 @! O* J. ^$ m* P
2 ^+ a$ H# \# g: `
var WSHShell = new ActiveXObject("WScript.Shell");
$ p& A. @4 W) B) T5 U7 [. y - M3 ]) l* f0 M* ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); / N* m. U' D& n' E9 G0 V1 j M
- [& _" _/ y3 @( R" Y; Psimple.SetLicenseType("Runtime"); : n& M( V `* G' Y
! n( j. w% m9 b( R
try 2 M7 i' P3 x1 [$ l$ s3 n$ A
{
- g6 T+ C( m# H9 z1 ]2 I; b+ Y // Enter the path to a model file! ' N; ]# ^: z6 J: |0 ~! p% x
simple.LoadModel("C:\\Models\\Test.spp");
7 Q; r9 ]- B0 A8 P. G} & _% j* n( v J" T
catch (e) " r! ~! \/ t0 W' |0 P: C, Z" U. Q5 B
{
- ?: n- K4 _( e/ h$ A+ \6 I WScript.Echo("Could not load Model!");
7 A7 x1 Q/ o& n3 i WScript.Quit();
% P1 V6 u# y* R# H' e0 |. A" s} ; b8 N k/ d4 F- @8 H
1 O' g! w8 r9 e5 @! [2 Ltry
, [5 l+ a; [8 m7 a! A{
7 o5 L& s. F( H& z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % X6 J: {& y- h% H# l9 ~# D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 e c- f" k3 P1 C: B: E
if (r == vbCancel) 6 O; j5 {- o7 g* Q
{ + o" d: Z4 n7 N; C9 m
simple.CloseModel();
! K4 B! |8 w1 F1 y) N' w, y WScript.Quit(); & Q. K8 r. T/ C* W- C( p. h x8 o
} : A H4 A" G# N1 y; l8 Z
} 5 h6 W1 ]# A M7 P A' i# f. @& p
( f9 z) e$ R* z! S9 C8 [# j
simple.StartSimulation(".Models.Frame.EventController");
% O- y8 i0 t/ D. i) @- R2 P 3 P: X% C: A! {7 u5 T
if (simple.IsSimulationRunning())
3 L; L- v4 F& S WScript.Echo("Simulation is running!");
) k% M& x# Z, P- h/ X: Z 4 R4 K; E. W4 ^# l N% Y* T
// Wait until simulation is finished
8 O/ s9 ]% Y; i( U% n. qwhile (!Finished) WScript.Sleep(2000);
' \$ K; W; X: V
# E5 d& W$ J0 c" ]. Ysimple.CloseModel(); ; @: d$ N# H: b/ t
simple.Quit();
) ?) h" m/ N& r/ v: Z+ M" `- O& nWScript.Quit(); 5 r$ {1 {7 g1 s+ y
7 W, F) F" f4 u" E' ?7 W
2 u0 L$ {/ A) d+ J$ Ifunction RemoteControl_SimulationFinished()
, O0 O, C/ p5 i* q2 M% M! e, l3 X{ 7 z$ Q4 ^& h# Y' ?* X, C" i- z" ^
WScript.Echo("Simulation Finished!"); |