Example of a JScript " N& ^! D4 h6 f# d+ N( u2 S' L
var vbOKCancel = 1;
6 x5 y9 {( a- {4 R2 F' Zvar vbCancel = 2; ' v& x1 j+ }( m- k! {( e0 a& s
var vbInformation = 64;
_% ]& ^# S# f3 h0 l9 ?' ^var Finished=false; $ s, @3 Y; J3 T, w
- r# x$ E3 z' u/ l7 `var WSHShell = new ActiveXObject("WScript.Shell"); 8 ^1 X# }7 ~6 r* d% {4 q- x) {
1 p3 E1 t- t% c8 evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . _. U9 q; i3 m
8 M* C/ m/ R ~$ E7 R
simple.SetLicenseType("Runtime"); 2 N$ j8 W/ E) E: h1 B
$ V. h" O8 ^2 v+ n
try
: Q# r( w5 v6 `9 V* V6 J ~3 a% y{
) T7 v7 v" e% @: [' ?' ? // Enter the path to a model file! / w0 h# i8 \4 G% U) `) L
simple.LoadModel("C:\\Models\\Test.spp"); 9 ~, \5 c3 o7 ]$ d! S9 p
}
1 [; j/ c: X2 v9 D0 scatch (e) % y# B \6 o/ ?5 X: ]& v
{ 8 y0 m$ O' g4 x
WScript.Echo("Could not load Model!");
- D& W. b$ c" L5 I$ D0 }; ~ WScript.Quit();
5 w* u* q% h$ X( t- M$ C} $ O3 p) K- k* s2 j
/ ]- g3 I7 Z. e: y% Q' i3 v- utry ) ^! A6 U% Z% k( i/ v8 s
{ 3 R' a5 b/ A4 x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * i! P3 ?2 k. Z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( l* j# K" g3 N4 v if (r == vbCancel) " @; a) z, ~6 s5 m
{
' U& x! `. ?" |; j& k simple.CloseModel(); 3 M) M$ l& V( Q& u3 s
WScript.Quit();
! @( g/ g5 G) `# B/ h6 n; r }
6 G: J' n- `' E7 _7 S j" z& n7 s} ) D& i H _, b; V; m
# F( u: x) y* r. y8 o8 N6 D+ G- Xsimple.StartSimulation(".Models.Frame.EventController");
: {: b2 I0 d/ J G/ s0 s3 e! I- d0 K3 j
if (simple.IsSimulationRunning()) 6 P% \+ C( @) X% U: H
WScript.Echo("Simulation is running!");
2 I, J5 ?( v7 u* Q. ?. W, x7 K
; U) E+ } `* L// Wait until simulation is finished
) a; c( H" L! i9 L$ Uwhile (!Finished) WScript.Sleep(2000);
, v- L& Q* ] g5 S 8 d9 E. ?. E, J _% T) E, ^
simple.CloseModel();
4 h- |1 w7 z% `2 q- \/ {simple.Quit(); , U" G8 h* j7 w& z
WScript.Quit();
6 V9 d) n+ O" e
) i$ i3 C h4 \2 H0 ?6 C9 r
7 Y# _- R4 u$ y; m: h! Lfunction RemoteControl_SimulationFinished() # m/ [8 W* f6 m( g& B: N
{ $ T3 W# O; ]! Z$ o
WScript.Echo("Simulation Finished!"); |