Example of a JScript " q( p' b! g" I q, u0 [+ y6 F
var vbOKCancel = 1;
3 }1 X/ v% \, Yvar vbCancel = 2;
\' }6 u$ |& R9 n8 t6 gvar vbInformation = 64; 5 x6 g$ z( n, F0 D) k) E; r/ [# O9 T- N
var Finished=false; * M; y( c. a# G3 D) c; P
2 z1 P, Y. O0 P: |$ m0 ^
var WSHShell = new ActiveXObject("WScript.Shell"); ) n% y* S( n. I7 b' w+ G
9 V4 [8 [* ^9 g+ H& X$ J+ e* ^var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 |& W1 R+ Q1 f+ `
3 O% m. c2 D( @; E8 {" @" Psimple.SetLicenseType("Runtime");
* t+ V9 S" o! H# h& `
2 Q3 n$ ]# D D. U/ q5 C9 M6 Ztry
- ^$ g$ v& s3 W7 u8 Y{
. p P {/ {. `& M% Q9 R1 Z // Enter the path to a model file! 0 @ x: [! G8 e- }
simple.LoadModel("C:\\Models\\Test.spp"); ' u& [( [) }, @6 b# v
}
+ `5 f/ r9 U$ Q5 A$ O5 V' }catch (e) 9 L! P- S0 C$ [. h. x
{
6 ?7 T' n2 _4 ~, W. V WScript.Echo("Could not load Model!");
; x; P1 b. h3 n4 F$ W WScript.Quit(); 9 N5 I5 \; o D, Z, M' X. g
}
7 Y2 d9 x4 ~' o * A0 q! d* D* a0 t1 Y$ ?% m
try
; o- c) p a, G0 x{
7 x2 _0 \0 e8 |/ I simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ { i1 S5 i# t r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 Q H% s$ a7 a- M6 S1 b
if (r == vbCancel)
, ?, j( E% p: X5 K/ F9 e$ Z {
( T% e5 C9 O" y$ C simple.CloseModel(); - K r; Q: Z, J+ c6 n% N
WScript.Quit();
" n/ P, w3 O7 o; K) y- I+ | } 3 d3 H( C1 s; s
}
& y6 H9 w3 X6 ~% d1 b6 W 8 i3 T5 a% c: h: J l
simple.StartSimulation(".Models.Frame.EventController");
2 V: @" R* u7 Y0 M# U3 N' P; X3 f
) k0 y( h9 E! }; U1 gif (simple.IsSimulationRunning()) 4 |: v1 f, z1 J V5 \, o
WScript.Echo("Simulation is running!"); ) F! k) E2 h1 n, D! S* S
: E- ? p# g# Z' l: u/ R( V4 \0 f
// Wait until simulation is finished
. p/ t1 T$ b' P3 O( f: y9 y# O# ~$ lwhile (!Finished) WScript.Sleep(2000);
# l/ V( Y6 I F4 Q: Y * d! G, h( N! Z( I' `
simple.CloseModel();
; {- @$ ~6 s. f0 v" V9 w/ Nsimple.Quit(); ) i& b) n% _5 A2 Z7 B5 e4 G
WScript.Quit();
3 |7 p) ~+ f* b, Z" v N: r) n; s& R5 d
, C$ O% W) j7 r. Q$ q1 {" `
function RemoteControl_SimulationFinished()
1 {2 G$ n/ A3 O8 X9 M& K$ v2 _5 e: E{ 1 J/ Q1 z4 F+ W3 m
WScript.Echo("Simulation Finished!"); |