Example of a JScript 7 d: e' G/ f# P. N
var vbOKCancel = 1; . j1 ] J* n$ Q$ j' P
var vbCancel = 2; , k; n* ?1 h: @ N$ j) v
var vbInformation = 64;
3 R4 l. U' u. g1 x; R9 Evar Finished=false;
. V- N. ]( @9 v4 _% Z
8 `8 m( F5 t. C- y0 o. |7 Q( vvar WSHShell = new ActiveXObject("WScript.Shell");
- ]6 Y& S8 T" \* q, ^9 D: H* E. G
; r8 Q/ D8 k+ h1 K1 kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); D5 x1 c- ^' z4 r i( E4 n8 b
# ^' O- V- S, r0 R1 F5 _
simple.SetLicenseType("Runtime"); 8 e! S" o6 G% ^2 ~, o' B
% Q' n' B( N' D+ n0 D/ d( t% Ttry
9 q7 E( ^2 U( D* |{
/ u! A2 h8 \. X: z- A& ^4 A // Enter the path to a model file!
0 z* P' v/ ?7 r2 U/ w$ i3 h simple.LoadModel("C:\\Models\\Test.spp"); & f' r1 u5 c: t: G F
}
+ X4 T( R4 Q& l5 L' E2 v( Ncatch (e)
% }! G% \. g: s& P3 n/ _{
% c" x" b& q7 `& C WScript.Echo("Could not load Model!");
& _* f7 H* p! k+ q WScript.Quit();
# R; `3 U% J$ A: u! \}
0 O# \7 Z- J8 V" O* v' D; j
; I& ]1 F- X! z! D7 \) z: ^7 dtry
( P9 j" i; ? ?) E3 [{ 7 G; w) q' x/ F2 b7 z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; G6 x2 B/ i* P4 M6 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 w- M- L" \& x* G$ o- N$ M/ P. Z
if (r == vbCancel) , K1 f5 V* f" O/ L, h! r5 Y+ C
{
) e3 [; x+ W$ ?' t& T' w3 B" y4 v9 K9 p simple.CloseModel(); " q3 d7 J, ~( W4 D; B. x0 \/ L
WScript.Quit();
$ M- c3 k, |& P7 T4 g4 j. q# L } . y6 A& Z1 }' t# s& h
}
% ~, C, ~/ v8 ?' A. N
' |; z9 a4 |* Z9 Q5 ksimple.StartSimulation(".Models.Frame.EventController"); + b5 Y$ X m4 O$ P+ [1 {5 a$ ?1 [
& {% F9 C5 g) [7 Q0 w' Z( x1 J
if (simple.IsSimulationRunning()) & [$ v! x/ w' x; w) u
WScript.Echo("Simulation is running!"); - _; u- K+ Y8 s
- B( h* W6 R5 d; u h
// Wait until simulation is finished ; S% w: [/ m( C- m+ F
while (!Finished) WScript.Sleep(2000); 6 p" q& d) ~6 c O( [% e
6 z; J/ a% H% V* @2 jsimple.CloseModel(); @# K* y/ B' q
simple.Quit(); . D& J3 G6 U2 i7 Q
WScript.Quit();
2 \8 D+ Z: m3 u, G; b5 e8 z2 }; [$ C % k0 Q7 t3 H# N% I6 {& j
! F: q2 z9 w7 c @- c
function RemoteControl_SimulationFinished() ! s- G& i/ V& |5 b" @% V: Q1 e
{ O: S' i9 \- U1 h
WScript.Echo("Simulation Finished!"); |