Example of a JScript
' ]0 E6 H) g ovar vbOKCancel = 1; & `& s3 F& M$ U6 O: J4 k. }2 m
var vbCancel = 2;
9 V' G, ^. |- ~- [8 H% s; r9 ~var vbInformation = 64;
6 E! M$ D' \ P4 q8 avar Finished=false;
' g1 `; _8 r8 A7 f # J$ I: m- v5 D1 G. g7 R# j+ i; g2 }
var WSHShell = new ActiveXObject("WScript.Shell");
; z& }) c/ `, j9 q i/ l4 F2 J' W
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 S a9 m8 q' a: c- u! K
. U8 S5 y& F5 }simple.SetLicenseType("Runtime");
& G; g9 l( N8 g+ G; |8 ]1 V; } 6 r$ s9 \# F# J# i* [
try
* |0 ?# s1 q6 B5 v; s{
0 C5 E6 z. [' _: q+ t // Enter the path to a model file!
) p) d9 E% ?4 g; u simple.LoadModel("C:\\Models\\Test.spp");
- H1 j8 ~2 M `}
5 P% m# d! I6 H% Q6 {. Ncatch (e)
$ t0 \6 L. }4 e) G2 T6 o{ * f3 v% e3 ~3 K3 p; v
WScript.Echo("Could not load Model!");
6 n; j/ S9 }9 h3 T1 @( l" V WScript.Quit(); ' n. ?/ R5 ~. ]" _
}
8 q: {+ e& m& j) `& I1 W2 e9 x
) V9 A5 A0 _ k7 v P9 Ftry
. W1 |8 B( O/ ?& v{
]* T2 C& x5 I, ~7 L; U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ ^) p, S5 m; ]' ]$ n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' E2 ]# o+ W: G4 k if (r == vbCancel)
: H% _! Y4 R O) m; C$ m$ r4 [ {
6 @5 M+ B: Q# y* ]. h simple.CloseModel();
2 D$ K2 A/ U A WScript.Quit(); ; ?0 }7 t$ f5 P" W/ } B- Q
} $ e5 z" b+ v& E: U: j: X9 e
}
" y! ^2 R% Y+ j7 w* z" Z) Y : p& u2 T* s$ q9 _* x
simple.StartSimulation(".Models.Frame.EventController"); / i. `& {0 L* D# G6 C
& g& _6 V9 J; x' n5 c: pif (simple.IsSimulationRunning()) ) Q0 }" d4 z5 r5 |! ^
WScript.Echo("Simulation is running!");
! k- X q- [# A1 V* b: i+ I ' p, J: o3 q+ n% _; {0 e% E% x% m+ G1 ^
// Wait until simulation is finished 3 ]: `. ]( T0 G* O7 m8 I5 F: }
while (!Finished) WScript.Sleep(2000);
9 ^3 h' Q0 F6 p ?+ M) D, r1 n
; P( N9 c, b4 R( wsimple.CloseModel();
2 b! G# P& Q) M3 i8 V0 isimple.Quit(); % I) {+ r, ^# r6 B, s- X
WScript.Quit();
' @' {7 }& K O/ j
# w3 X6 U X- v& B4 G y4 \
% m% M. e# ~) Y0 I) H# efunction RemoteControl_SimulationFinished() 7 l0 m+ K# q5 z. Q+ j
{ ; k8 P% O: T, k4 y! |: S% f: h# A# ?! K
WScript.Echo("Simulation Finished!"); |