Example of a JScript
8 s, q9 E5 _) i( I0 a6 Avar vbOKCancel = 1; ; U: @/ T! ~; o- t# e' D1 ~
var vbCancel = 2;
% i% G' h9 N! y& m3 _$ rvar vbInformation = 64;
6 `! `9 d I0 ]4 ~8 Lvar Finished=false; ; }& B% R3 `& Y I; H6 G/ B
9 g$ q! v/ q$ E1 [var WSHShell = new ActiveXObject("WScript.Shell");
; O# o# \- s6 P
) Z3 i% E' h* R! uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 X$ @/ x4 F$ B2 t5 b
, f$ J3 Y5 u9 J @* N" ^simple.SetLicenseType("Runtime");
6 T( t4 C" |! p" H* H$ ~ 3 `) i9 }) g9 w& G6 _' z
try
$ m0 a" R- w5 K1 W: x8 k) C; |{ + }2 @& `6 g) w9 G6 v; [5 a
// Enter the path to a model file!
9 n" t$ p& M2 t- v, F2 ]4 B simple.LoadModel("C:\\Models\\Test.spp"); ' O. F% \) k% @/ f% Q
}
- j" h7 B2 k! N. ]* A5 o0 A% dcatch (e)
, W# y$ p9 J0 X- K( D8 S/ w{
4 e) U5 ^) [" @; n0 u WScript.Echo("Could not load Model!"); 3 L3 G: C9 {+ E
WScript.Quit(); 8 {% \$ E% ~ y1 z% y( Z1 Z: w# y' y
}
8 j, W0 L2 F+ H$ k' _* M) F( S $ C$ D1 P* h; d+ r) f; K
try _4 h H1 M% L1 ?0 V
{ 5 f$ v* ~4 G. K; C
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) |% _7 t3 j, n; Y5 |9 }0 I' R, v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); B" F3 M. I/ a; @# U7 ]
if (r == vbCancel)
- w, {2 W! `2 z; b1 H) V0 I { 2 P: p1 c0 D3 l. m$ H
simple.CloseModel(); 6 N$ F2 g% J) t* e& u* v/ s
WScript.Quit();
: Q2 A2 Z/ H* D7 }0 {! `' L X }
( p, B! W' f$ c2 p4 Q. j* `} - B3 Y5 n9 \2 O
. d# ]' [) O# I- J; qsimple.StartSimulation(".Models.Frame.EventController");
: v# A) E; A! n; {3 I0 X' a2 d % I% i: p1 l1 G( p2 s
if (simple.IsSimulationRunning()) 0 D4 x: o$ A1 K5 ~0 R$ W1 K
WScript.Echo("Simulation is running!");
. U# q I) A, T
9 O; [: x" {9 K( W4 f% a- y// Wait until simulation is finished
0 o2 \# ~$ Z0 j8 O- e1 P8 x0 hwhile (!Finished) WScript.Sleep(2000); 3 t7 q+ E ^+ @& _
4 i5 t/ q$ R5 H, z3 Z; d% ?
simple.CloseModel();
) g( I1 x' R+ D, g. I! l8 vsimple.Quit(); - C( b! A3 }, [4 @; u+ g( w
WScript.Quit();
% ~' t' N* s2 A% q$ S $ |5 \9 `1 @/ F0 g! c
' a+ n. y0 {, s: cfunction RemoteControl_SimulationFinished()
8 G8 m+ `& R! u" a6 ^4 ~+ p# ^! j d! x{ , ?" p. T, q" r0 L
WScript.Echo("Simulation Finished!"); |