Example of a JScript
% u9 r) ^6 s3 `2 z2 W; evar vbOKCancel = 1; * W+ R9 c' G& O+ y5 `+ U
var vbCancel = 2;
# S9 X) n U5 o- U0 Fvar vbInformation = 64;
. M" \# b* ^) J/ f# L7 _. lvar Finished=false;
. N y2 B7 Q* n$ Y - c) H, o6 S. f. R0 Y, ?
var WSHShell = new ActiveXObject("WScript.Shell"); 0 s. Q5 ^ x: s) ~. ?1 t
) F) z+ V. q$ K0 Dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 m$ h) N8 o G# }, Q+ f
4 Y% K- q% D5 p: ]# g0 Esimple.SetLicenseType("Runtime"); ) J& {9 `. ^2 ^- ]3 w
, x! q% v( h8 b$ s% P
try
# V. q) i4 P( w3 k) g, C2 N4 S{ 1 Q7 ^0 |2 Q, O7 H( |
// Enter the path to a model file!
2 w4 A1 S9 w" {' P' H" n simple.LoadModel("C:\\Models\\Test.spp"); $ [" ]* e$ @0 U( D$ K+ |3 U
}
3 z! X# }" o% m; \4 A6 scatch (e)
) k: g7 b( l& _ w9 o! [{
! X! j9 U4 B9 ] WScript.Echo("Could not load Model!");
' o. u! K3 g2 U9 k: m4 ~/ z3 D WScript.Quit();
5 Z. @ x8 C( X' R9 }% y}
; ~; ]) l. H5 w. f6 G0 x7 I
% G) r& F5 v! Y p0 Q" H5 i+ I; ~try
5 w7 U# o; w' v; N g- a7 M' Z{ 9 t3 n$ | @: W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ h8 u& h+ [+ [0 H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; _8 q- e! [, d, F1 |
if (r == vbCancel)
& t' M# P+ F6 [0 @/ L" S { % K6 h% K) u* c! _5 l- Q
simple.CloseModel(); ! H1 a8 T3 s& W+ q: l, e1 n
WScript.Quit(); - v" I% }% K6 P) W6 _3 C; \) E: C
}
. R+ W, o: X, T d4 ~}
( C6 I3 r0 a5 |$ q8 y
; h) G) b2 U5 esimple.StartSimulation(".Models.Frame.EventController");
' ^) t( M/ T4 k) u ) t! u% Z5 ^/ q" A; C5 M! m3 {1 g1 r1 G
if (simple.IsSimulationRunning())
9 w) A$ D1 Q7 u) S1 C0 ^3 {: j, c% r WScript.Echo("Simulation is running!");
' R' O" Q+ H- `6 B: G, s1 `
1 U* y, A8 D; v// Wait until simulation is finished . ?; ]3 l; m1 W7 F' `
while (!Finished) WScript.Sleep(2000);
7 A9 F9 }' w( p6 ` 8 u3 R$ w: u/ Q
simple.CloseModel();
1 L" O3 g0 y) c# Y' {4 ssimple.Quit();
. x( I* N8 T9 P7 uWScript.Quit();
9 X8 ?/ B8 n) @0 e8 K
9 b' m# I2 h$ F2 U3 M0 p7 s
9 A$ b# k/ s- V+ t b' N5 Afunction RemoteControl_SimulationFinished() # z7 S3 X- I4 |+ }8 q9 U4 T
{
8 y2 t0 F h8 |5 N4 l) X' Q% Y WScript.Echo("Simulation Finished!"); |