Example of a JScript
6 B( \, W6 I K& k5 n% M0 Bvar vbOKCancel = 1; , N: K) ~* `3 l
var vbCancel = 2;
7 h( [( j r* a6 zvar vbInformation = 64; % N. @: F& {% z
var Finished=false;
! w) H* f, ^+ z7 v + I; H7 g6 ]& y$ c
var WSHShell = new ActiveXObject("WScript.Shell"); 6 C2 I& C! S9 U/ B. ~) @! l
, P+ v. `) s% N. T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , E( _* f. K# y8 [# `. Z
: k% a6 w% M2 h: F+ B
simple.SetLicenseType("Runtime");
- A0 }, n' h S. o; [% F " K+ h4 F" ^, J& O
try : q) V* k4 b3 {" h- h
{ 7 g, A' _/ _$ [7 P- C
// Enter the path to a model file! ' g7 ]8 S7 V: c3 ~: f
simple.LoadModel("C:\\Models\\Test.spp"); 4 t# J& ]+ L. t
}
; m% i3 W n& L, t% e ucatch (e) 9 J5 }8 |8 r" @! b
{ 3 V" b. V7 b' M( k! Z) h
WScript.Echo("Could not load Model!"); # L6 N( t4 W$ D) A) J
WScript.Quit();
3 O* ]. D/ @ V) |" W( x} N" a4 [& P; h: \4 k- v( }9 A
+ ?3 c- E) _( @$ \2 j( `, qtry , S8 [$ x n/ o, @7 S8 _
{ ; \3 e. y1 C8 n# I: C b$ Q7 A, @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 e; m* k7 E t8 \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , R! v% K, S" r+ ^8 H+ Q; t# e$ i
if (r == vbCancel) ' R8 g5 \1 L4 a' p5 }+ i0 @' R
{ ) g: X# H1 ^- q- b1 @; E
simple.CloseModel(); : b' u) q$ y. ]$ c
WScript.Quit();
$ S ~9 N* r5 b. o1 [* Z( X }
" C" t1 P3 w+ G3 i} 5 l+ A( M k; p2 A5 ^( b0 O- C$ a
. m* E Q' A5 @simple.StartSimulation(".Models.Frame.EventController"); ) L8 g# W% _5 r) P: |
- v' k2 g3 L/ E8 G3 gif (simple.IsSimulationRunning()) - k) r- E+ |% K; |) O) j) m
WScript.Echo("Simulation is running!"); 0 w; A1 m, P3 J2 X! q& p
1 O; y: e$ q; n Y" k4 u, E
// Wait until simulation is finished 5 J7 F1 ^9 p/ M% y0 K3 F7 C
while (!Finished) WScript.Sleep(2000);
; j, r% q R' S# Z, j % ~, w$ }6 _& M* \
simple.CloseModel(); 0 Z+ _, H" o. U
simple.Quit(); * P/ y- r: f4 P5 u
WScript.Quit(); ; b, ~9 e8 Q" r- t; G' A' B
( e% e1 E8 i( x* Y1 o ) `: a/ R3 C: r
function RemoteControl_SimulationFinished()
- z, q( ?2 O8 ^: b" Y8 h9 k{ % |3 ?2 }4 L- U& ?! M
WScript.Echo("Simulation Finished!"); |