Example of a JScript ; O+ i5 h4 H$ z8 W( t
var vbOKCancel = 1;
* d3 h f$ Y5 k' ^/ s+ N( Dvar vbCancel = 2; ; C, a3 u- v4 M% W4 Y
var vbInformation = 64;
5 Y4 n3 _. o6 P1 X; Hvar Finished=false;
( B" k3 N0 l! }7 \' u* c7 o
2 z+ l# q6 [+ X5 w+ N( ^2 O2 K/ hvar WSHShell = new ActiveXObject("WScript.Shell"); / L1 O+ D) g. Z/ o4 q
( H8 \8 m6 [- D7 S. Z Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& L3 z4 n& d( g5 V/ t. w f# D" ^1 m2 t; }. K; Y9 a
simple.SetLicenseType("Runtime"); ( i: P( T* j* Z3 ^" z/ }, Y
+ y9 {8 S( u) g, X" V' B4 Atry & y0 W- I+ v# i. _
{
$ ^" C9 h; U' w+ N // Enter the path to a model file! 7 P) y# C9 z7 B; w* s
simple.LoadModel("C:\\Models\\Test.spp"); / D' |# o" T8 w: Q- c
}
# U: q$ B- p9 P* n- A8 O% w3 rcatch (e) 9 q. Q F( t- ?
{
# L6 i5 {- W% s2 `( H WScript.Echo("Could not load Model!"); 0 y' I) i. B4 Y9 t
WScript.Quit();
+ S L9 _* S: C8 \% _+ t0 E} . @, ?( i' N# u1 |
/ B7 B7 e! r1 Q0 x9 y- G
try - e( W' ]* w( W* x5 Q
{
% w' J+ h6 V& i% L# w+ N4 X2 y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
' L( I9 l: x& l. z$ p, S: U r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 d7 U6 i, N6 c/ l) k if (r == vbCancel) 5 s7 e6 D! a, V, b, `! v& R
{
$ S& c3 C7 ~+ H5 H1 I( c simple.CloseModel();
9 Q- P- Q) A8 ? WScript.Quit();
; F( }( D- z0 W+ z1 a# @$ d" A: X1 Z& R } ) s- i" A+ r. y8 s b
} $ G' ^0 e3 H5 M* y% x
: w7 P. K- q- O/ H8 H8 lsimple.StartSimulation(".Models.Frame.EventController");
. x, F- p% ~ n" l) S
6 O" V z E0 E. E/ oif (simple.IsSimulationRunning())
7 B/ |, j2 ?7 `3 K1 @ WScript.Echo("Simulation is running!"); 7 E9 g5 |: r' R* J. r/ T
9 x! N4 b; e$ Z. f" s: \9 f1 m' H
// Wait until simulation is finished
1 A* g" K7 n/ v3 P2 twhile (!Finished) WScript.Sleep(2000);
& G# u9 j$ U- S( a
8 l' y* b @ Ssimple.CloseModel(); - ?5 r" N$ n0 {; m' A: N
simple.Quit(); ! @* @& o1 G; n8 E
WScript.Quit(); 1 K! w& O. v) Q# }' V3 h* l' K
) S; F" ~/ S) I% R4 y4 f
9 Y' N2 x! r( B2 A+ u* `
function RemoteControl_SimulationFinished() 4 |0 V4 O4 l( S% m& o0 @
{
0 _- w+ }- D7 N# | WScript.Echo("Simulation Finished!"); |