Example of a JScript
6 j* R& a- Q2 B$ Z; _: q; Gvar vbOKCancel = 1;
z- F# D$ S$ D4 |var vbCancel = 2; ( |! V; Q5 l j+ ]! E$ G& c
var vbInformation = 64;
1 t7 d# b% _) m0 \* Evar Finished=false; 0 ~+ D! Q$ |/ Y; b
- K! N4 e" y. z
var WSHShell = new ActiveXObject("WScript.Shell"); 1 Z# }8 |# t: ?# R
z* j1 {( r6 G. k
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) g# D) }; }) E/ E2 b) q# x/ ]8 i
( {( r1 M9 [5 E# F
simple.SetLicenseType("Runtime");
: |5 j. j/ Q, b0 v: R# N' k4 b
* P2 s( P6 B" m* B* ^try
8 e% p4 u3 C* E& {" S# j: {{ - x, b4 i2 g" b8 Q; ?+ X
// Enter the path to a model file! $ C7 ?& N8 P2 c
simple.LoadModel("C:\\Models\\Test.spp"); / k; p5 h/ [! g9 H5 R# X8 R6 N7 ^
}
5 P/ H! u/ D# t. mcatch (e)
" t0 e5 X# N! B# b2 f{
& R5 h! Q# _9 d3 ]& [) h WScript.Echo("Could not load Model!"); 1 u9 Q( L2 ]3 v }% o. s% s
WScript.Quit();
& w. Y! B/ H7 ~6 |3 S} 0 P/ i; v! X3 `% R
1 {" p4 Y$ _7 n- D0 utry
( f& x8 {7 W- M{
8 l# b6 w/ ^1 H2 K simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % \7 Z6 s+ U7 S! d' ~' z6 Z, d2 n
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 p$ m! S: L( `3 O2 s; P- Q if (r == vbCancel)
: L4 c$ G( M* ?6 P6 i+ T {
- a4 L, j! @0 d* m) [ simple.CloseModel(); + l% A, a$ C# G4 C4 F
WScript.Quit();
* q0 |5 M( n% p" Z/ r }
3 c$ }5 {2 V1 s% \} : m, \1 J! `" L! ]
) g7 b8 A$ i4 O/ x, n0 f
simple.StartSimulation(".Models.Frame.EventController");
' |' o: D, C5 C; b$ o3 W , z2 H( d# _, B% w: E$ r% L
if (simple.IsSimulationRunning())
& i0 v) ?* S& N. G) T WScript.Echo("Simulation is running!");
% _2 D0 e) d- }) S; |
' `2 p" t* z& s" D" Y. q0 C6 j& Q// Wait until simulation is finished
9 u9 }$ D& q5 W8 Ywhile (!Finished) WScript.Sleep(2000);
8 h; S- _, G0 \# H3 Z. O' p t . G3 c4 Y2 l7 @1 q1 R# R9 {
simple.CloseModel();
) H7 w7 `- K2 d, isimple.Quit();
* T& b! U' D5 O/ B! Z& @" jWScript.Quit();
: b5 g- e5 h% Q" G) r5 n0 i: a
* k9 k& u/ d& k4 {6 I* l* J0 P9 c
/ F+ ~$ o3 z" D" ~6 v! I4 Wfunction RemoteControl_SimulationFinished()
4 S2 p$ }5 d6 o& z; ^6 @ o- u{
' c6 D1 V8 r/ p) ^5 L WScript.Echo("Simulation Finished!"); |