Example of a JScript
, o7 p3 G+ H T1 h+ {var vbOKCancel = 1;
/ g6 R& x6 F% e% Z/ Yvar vbCancel = 2; ) I: m! q* T8 k3 U: \
var vbInformation = 64;
; t! s1 }( {1 \4 Fvar Finished=false;
Q; y+ G1 G2 G- l7 P# E ) Y0 g) W/ p+ T$ [* q; v8 ~, R
var WSHShell = new ActiveXObject("WScript.Shell");
7 T1 K7 A! t# l0 i: ~$ b
( F% F# T: @7 d: E* [/ R) u0 [% |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 ], V( C4 U5 Q8 P0 K' e4 @
) e$ V- L( p* E5 q
simple.SetLicenseType("Runtime"); 3 T# T, J3 E+ F, n0 ~5 R! Y, h
9 O, f8 R, L& _* D) \" jtry 4 ~* N* e$ u0 g5 [* `
{
6 t" W( X8 |2 [+ ^, B // Enter the path to a model file!
6 a8 e4 M6 B- ^3 \ simple.LoadModel("C:\\Models\\Test.spp");
( W! I) V8 Y9 O) Q# p} 5 r" \9 \5 r+ y8 p* B
catch (e) n, o" A) _9 J ^ Y
{
) Z. P2 L% {* ^# t+ z! |2 s WScript.Echo("Could not load Model!");
1 P2 z, Q& F, d" n$ @ WScript.Quit(); U3 D, i! x# H8 {
} & y$ l) v" h1 c& y" U* s* l: P/ C
1 s! o( x* l5 c& Ztry
7 f" ?, }" h: M. V& h0 @0 Q{ " d1 N9 w5 N8 M/ d1 {' o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& M& N" D1 l% l$ p. y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 V+ A, E0 } v" B1 p5 {
if (r == vbCancel)
9 Q/ T5 b9 y1 D8 G7 {! y { . \! d* G$ c3 [$ {, k: R
simple.CloseModel(); - k$ c4 w: h% U/ Y1 O. \; L$ X
WScript.Quit(); 4 V, A2 E! r+ \
} 7 J0 Y, X: ~: K/ n2 u
}
: D% }8 w2 `! V 8 \/ o4 X. L0 y8 ?" l
simple.StartSimulation(".Models.Frame.EventController");
& q+ k w) v0 J# L4 u% b: M) t
" H3 L1 d9 I t# W4 d. c% R$ U Bif (simple.IsSimulationRunning())
2 ]( z' ]' Q2 x+ d' I! I WScript.Echo("Simulation is running!");
0 Z1 j C' [) d0 J! Z ) y3 u7 \! N1 G; i Q/ Q
// Wait until simulation is finished
3 Z5 c! W) h! ]! j Jwhile (!Finished) WScript.Sleep(2000);
# B# h% v7 p. h7 C* k; Y 7 R) d5 F. w$ t) ^
simple.CloseModel();
/ t" x- L/ b. p2 x# o& Psimple.Quit();
7 H5 W" {, t( _4 V+ G) dWScript.Quit();
) A. ^ N Q9 E) m8 N - W& N3 o# K) A! b7 d8 \
9 l2 y H& |/ }: l( f, C- S
function RemoteControl_SimulationFinished()
R+ O8 J- J8 {{ 4 m( P; d- d2 h# L
WScript.Echo("Simulation Finished!"); |