Example of a JScript
/ S; p$ P" c( x X1 q+ I5 }; Q# k# Yvar vbOKCancel = 1; B% k- k0 a+ x! m/ }$ ]( B
var vbCancel = 2; ' A+ _6 a$ Q6 M$ J9 n
var vbInformation = 64; - V5 m: T7 U+ B/ s; ~3 h; `
var Finished=false;
' {7 O3 _ P( o# f9 ]
# ~0 f4 g# _( Qvar WSHShell = new ActiveXObject("WScript.Shell"); " Q/ Q$ X% }" M1 h+ I: r
' @" T1 x: _$ q) jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
+ y1 r' I/ K4 B
& a s* l, J G- g+ R- usimple.SetLicenseType("Runtime"); # z( q8 M5 {4 x( {
1 z8 ~# Z; I, y4 m
try ! g o# q* f0 W. _; O) N$ ~: E0 }
{ ! S$ }3 f" t2 {! c, i# ^8 g6 t% F
// Enter the path to a model file!
; Y4 n; P8 g; H+ S2 T simple.LoadModel("C:\\Models\\Test.spp");
1 p. h5 m$ @3 P" f9 A0 t) L} 5 O& G1 I9 y0 O" @& I
catch (e)
: d! \. A" N0 B0 C% I* D{ 1 J9 s1 l5 n7 u- W, g
WScript.Echo("Could not load Model!"); ; [! e" E" `+ o5 u/ r
WScript.Quit(); , A/ n; [% J- f n1 d4 ]
} ) q S# q) G5 t% P0 B+ M
; E" Q: i* E5 z3 k
try
- S* `. T" [6 B{ 7 \4 `2 l4 r+ M* d& }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
}$ P; N- k% i8 K6 C/ h z' p$ [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, x* O5 }9 r# w, U; l if (r == vbCancel) : C) |+ C- E6 q2 z* E- e" D
{ ! q; K' m$ ` Z# i
simple.CloseModel(); o6 W" h) Z& L
WScript.Quit();
. v. d: x. K6 p! N% z/ b }
' q2 [$ A& @% {$ r ?% e}
- n+ n Z, q. i; Z5 V
8 o# ` c: p6 C D+ ?) bsimple.StartSimulation(".Models.Frame.EventController"); : u9 {, {% V( b( A
3 t+ C4 Y/ u& ]+ O
if (simple.IsSimulationRunning()) & ^- ?' y# I/ U4 A" i4 [; B
WScript.Echo("Simulation is running!");
3 {% J9 l8 r/ s, w& \7 ~% \% ~$ d
1 o9 }# A) a6 t* y9 A# d! E) ?// Wait until simulation is finished
: ?" B/ }7 j( P ewhile (!Finished) WScript.Sleep(2000); ' b. t" q( s5 a* N0 [+ P
. k7 @% h9 d4 c7 t& ~simple.CloseModel();
2 S, z* w8 \! C7 \4 |* Gsimple.Quit(); " ~# b6 @ M- @1 I S2 [! F
WScript.Quit(); % Z, G* C% X6 _& }" e2 U
; Z/ Y7 H. N% v% K+ r. W# J
/ K/ K5 ]1 {3 r" h5 y5 H5 W7 f+ W, D
function RemoteControl_SimulationFinished() ) X9 s5 z4 i# k* [* u: }5 u
{
* |5 v3 |6 Q* h8 `) u% A WScript.Echo("Simulation Finished!"); |