Example of a JScript
: Z8 H; @9 ]6 ]4 X1 [6 Kvar vbOKCancel = 1; 1 F+ D+ J) a7 g) x/ x
var vbCancel = 2; l- M/ N+ G0 s1 T4 n" A
var vbInformation = 64;
* C( {; L" ?" Q. @7 h$ _var Finished=false;
+ H; q) n' Y; a0 `- d 6 r$ ^' M$ R6 W
var WSHShell = new ActiveXObject("WScript.Shell"); * o- g+ U9 |6 c$ k+ a, |
" J1 F9 Y7 f+ _6 O9 j8 A; [ Mvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + B: w, B' z$ J: R2 D5 Q1 L5 s/ a
. s1 R* l5 K3 L6 d3 @8 F5 Q2 msimple.SetLicenseType("Runtime");
# } D7 z S- c F$ i7 G" T ?
1 H" B! O; ~" g Q6 Qtry , F% ]! H/ r T B+ p7 ~4 f
{ % d0 i+ {7 S; ]
// Enter the path to a model file! & ^! w% Q4 v* r, @8 I, ?( r7 l- \
simple.LoadModel("C:\\Models\\Test.spp"); " i- }1 p" Z2 M$ I* Y7 Y7 d
}
3 H$ x# n1 F6 p, o7 pcatch (e)
0 m) p& {+ a3 N) k5 |; Y( w3 l{ ~* @3 Y: h R
WScript.Echo("Could not load Model!");
$ f$ ~1 Y9 m( ~+ R WScript.Quit(); 2 R& H: T) Z+ w( \
}
. A5 z2 y/ ~' E* n0 L) x$ K
# \& H1 h% e/ X0 [2 A8 A0 a8 Htry
0 j( p# N3 U$ E0 D* @{ ( y& _9 K7 K8 Q2 ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / T; \) m% ]; s; H5 b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 w/ i- N8 v4 Z( R+ z; v5 a4 O if (r == vbCancel)
( R% b% G2 o' S; Q9 i( y { 3 w8 Q% h e+ H/ U$ t D- `( ]
simple.CloseModel();
% j& Q3 j1 H6 m h WScript.Quit();
/ V2 O0 j, Y* x* t& r2 N* B }
* e5 |2 V" k1 h1 c: `% G} 4 w* t; ?9 f1 P# [/ A; T6 O
5 ]+ I W0 E% j9 a
simple.StartSimulation(".Models.Frame.EventController"); / |* }5 g! [5 U' N' J' J
3 Q G; |+ Y/ h3 E
if (simple.IsSimulationRunning()) 2 } e4 D! f, l' Y l
WScript.Echo("Simulation is running!");
+ z# ^4 T! O( z; f " _: U, n' k& }% X- M
// Wait until simulation is finished ; ` g# G1 ]5 { P, L
while (!Finished) WScript.Sleep(2000); % y- X8 n3 D- S) V2 C4 \
8 ^- @# y v c; ]/ ^simple.CloseModel();
( ]$ H- s2 o$ s9 j3 v, msimple.Quit();
8 b5 ]- t) d, t# t/ T0 W) F7 ?8 ?( jWScript.Quit();
- u7 e0 t4 U, D$ n# N ! U! \5 V3 U- a4 X9 ?, M
! n, Z- V w: Y3 [0 T$ i: xfunction RemoteControl_SimulationFinished() * F; q2 f/ H4 ]* X
{ 2 Q6 I1 J9 K, l/ A' L
WScript.Echo("Simulation Finished!"); |