Example of a JScript ) P5 J! `+ x: A$ f8 ]/ k" j
var vbOKCancel = 1; K1 }8 K) b0 w: C# e( J; \( K
var vbCancel = 2;
* T! X1 d. Z8 @) Avar vbInformation = 64;
, b% v, C, R. f" k# e5 g4 jvar Finished=false;
# V4 g8 H' u, a) j! x+ x* z! O 2 E0 q, R& F* E" y# ^' b6 A
var WSHShell = new ActiveXObject("WScript.Shell");
) ~9 \! u/ g4 `# B" b/ L
/ |- f U: B3 e3 a; c1 mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: S) x( f/ X- T# T, h6 C / R* I5 v0 L4 E: w
simple.SetLicenseType("Runtime");
2 q3 E" A! W: f( c 6 X& E6 z* n' D4 |9 T% K$ a, {, q( W
try 2 M, s5 L% P3 J7 L8 |7 _8 Z
{ % o; f- A" H3 G& X0 e: h: h- X6 `
// Enter the path to a model file!
7 ^! k$ s! B+ j+ l simple.LoadModel("C:\\Models\\Test.spp"); 9 _1 i; F- R1 T6 i* y8 M3 \' p
} 7 _6 O% u5 _$ v( b( b
catch (e) $ m5 B$ R, Y, e4 d) j6 P
{ . z* t% _2 z0 ]5 X
WScript.Echo("Could not load Model!"); & H# P$ Q( Y' O p% T
WScript.Quit(); }9 X8 A0 P6 b* I# f
} ! _7 p4 u; G/ u4 h( p3 d
6 m. |: u: g+ m
try
X# u, U7 H& a# m( Z{ / N! P& X& D2 B- l+ q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ s0 r) p w* `/ x) P7 G" N( s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # M2 h. U) e _4 P( W
if (r == vbCancel)
( i) K9 [8 }6 M: ^& F3 z2 D { + ]( N# P" w3 z5 Z- k" {. {- `$ M
simple.CloseModel();
* d" D# P8 W L; ? WScript.Quit(); ( i2 Y$ r* Z S- S6 Z* y
}
O! u% I X1 {; F- s} " r! b* B1 B) u% u
; I3 e1 p, r' U' g( L
simple.StartSimulation(".Models.Frame.EventController"); # d% N" @- Q h" h+ m/ Q
4 ?7 r) D; W h( F- X7 L0 d5 S
if (simple.IsSimulationRunning())
/ i3 i6 K$ Y' S1 n WScript.Echo("Simulation is running!"); & f- J+ I. C$ l
- W+ ?' y5 G( W, [* C$ T
// Wait until simulation is finished
7 \; K* `; V! } Owhile (!Finished) WScript.Sleep(2000);
; ]/ l( R, G# |8 @' M8 a - G3 d. {3 R6 S' X! H4 @
simple.CloseModel(); 9 F% t) l5 y+ A% ]3 c+ W/ q( m( h
simple.Quit();
+ n4 `5 o& w1 v5 jWScript.Quit();
2 p' D9 x1 Z) g& g& y! o* ^ 1 }7 j5 d: [4 R7 A
8 I- r7 Z" d- H/ W" [" B& Y, F
function RemoteControl_SimulationFinished()
- s x( P5 o$ I# s2 J{
. e W( l" ^. x9 B: g WScript.Echo("Simulation Finished!"); |