Example of a JScript
5 ^1 J' A) D" ~( _0 S0 avar vbOKCancel = 1; 6 T. w+ N0 M" l- P; i/ }- X8 z
var vbCancel = 2;
0 C/ g+ f+ U' ]5 p6 @) Evar vbInformation = 64;
* H/ s+ o' A8 S4 D; `var Finished=false; {! G2 w1 H& N# ~5 s9 h5 n. U3 \% |
5 p) m/ U$ h* c
var WSHShell = new ActiveXObject("WScript.Shell"); ' }! {4 I5 k) r
- o: b3 H8 a- V$ _* F3 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! S$ s* n3 ]1 G7 t# D2 r# h& g
1 v. V8 ^+ K6 [8 ^# W. vsimple.SetLicenseType("Runtime"); : \# v, ^5 z: G9 e3 ]/ O
8 ^# o; ~) @" A5 l8 ]try ; I5 U+ G% u8 u! w
{
" ?- S0 y; T$ B; ]0 R$ F5 F5 A // Enter the path to a model file!
( O+ P1 q0 b7 e" r simple.LoadModel("C:\\Models\\Test.spp");
6 v: k0 z% F9 x p' f2 J" `}
4 b- A0 k" [6 e2 c" ~+ J+ hcatch (e)
3 m P3 c' X& b' V F% c3 B+ e, l- b{
& _% a) U1 E9 b" A WScript.Echo("Could not load Model!");
0 ^6 n& G& L$ F5 b WScript.Quit();
- N$ R# u; y$ O; r3 m( |% }! h% }} / {. V7 ?) u U! Q7 B& P3 {; ~2 Q
( O/ i2 J7 K% s
try
- v& z3 ^2 F% }" ~# O6 |( H0 B0 E{ ' T E% ?9 B% `' r; ~; P8 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 y1 ~' A' v4 D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 K: ^. w. J7 S- m" E# {- C5 J* |& q
if (r == vbCancel)
+ e3 C; T H1 ~' u: n2 O) \ { % J7 H3 t( J" A0 C c
simple.CloseModel();
6 ^% V7 `" V* W6 K5 C6 z! u- G WScript.Quit();
9 F J5 C3 b+ X" ~4 Z6 y }
) f: F' R! |: j# ^ ]7 B4 J3 X}
. q. @# l& Q1 R; L' e7 B 7 S k: Y" v- {" s
simple.StartSimulation(".Models.Frame.EventController");
" v+ m7 B R7 T' }' _! J& [; I
8 g8 w8 z" y. ?) Jif (simple.IsSimulationRunning())
! E/ a) t7 `: ~ WScript.Echo("Simulation is running!");
' n. M& `( s; W1 H5 _/ {; Y, G
3 D3 R0 m7 V w: C& `2 ?- _* {// Wait until simulation is finished
/ E# u' I# F1 ^1 [while (!Finished) WScript.Sleep(2000);
' m9 z; l" n" K$ Y 3 g/ v: c n# O8 {' n [4 n* K3 T" t
simple.CloseModel();
4 n2 [! B) U& H( H3 S# tsimple.Quit();
5 m2 x7 M9 e1 @9 z3 t, V6 k, \, xWScript.Quit(); ! f2 Y$ h4 S+ S% [2 x
7 M- y2 t( @# i+ B
' y$ H: x) h) ]' H# m5 Z, U; \function RemoteControl_SimulationFinished() 6 y- `0 X: f8 W
{
5 s9 D; F" i" u) \ WScript.Echo("Simulation Finished!"); |