Example of a JScript
& j; [( `. Q* H$ ]- |var vbOKCancel = 1; " D0 n y2 a* k; o! P
var vbCancel = 2;
6 m* u5 h% x# w" P6 Lvar vbInformation = 64; 7 A0 k! Y5 v4 M
var Finished=false;
! P: V% @" j- X! U$ R" J & w* ~) R4 s b2 K* h/ i6 ~
var WSHShell = new ActiveXObject("WScript.Shell"); / X$ _9 A4 U' _
0 B, K7 L+ [ L( O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 _7 s% d' \& R5 O) L. C4 l
$ I1 t2 e3 m! T( qsimple.SetLicenseType("Runtime");
/ J2 _4 F W, H
7 M6 m! y$ h/ }8 N) r& ~8 L4 Wtry 2 _3 \( }2 X, l0 T/ Q" C: I
{ , Y# D' j. y$ O5 h& H& H2 {
// Enter the path to a model file! * |# H$ ~$ G7 Z
simple.LoadModel("C:\\Models\\Test.spp");
; z7 @1 K8 G& a+ O# }5 n( y}
" Z( p5 b" S3 C* D- n7 ^catch (e) l9 t6 t9 T2 u- Z. e7 k2 c. C
{ ) t; |# ~& _; A3 r' t
WScript.Echo("Could not load Model!");
3 W2 i! f4 B2 b0 R- h* e' W WScript.Quit();
7 G4 Y# I+ g; ~1 _/ X} # \* E2 \+ ?1 s" ~
7 ~( v& W4 u! H6 |- Rtry
2 R( J% L" e7 F& T9 x* f4 b: i{ 9 Q" U& b& ^3 i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
# N5 n/ U* K/ @& u0 a. U) k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 k. H, Z( M6 {: T) k3 p
if (r == vbCancel)
9 M; l% R- ~' P3 R& Y7 |+ S { ( Y# P& L' `, V/ }$ L4 V' P( u
simple.CloseModel();
3 |8 a6 [+ a- Z WScript.Quit();
$ O' x4 j2 i3 N3 K- n" V0 \ } 7 q3 B' I+ {: `- K7 D) G
} 0 b' N0 f5 E: s
2 i& I! w2 X. G: [! }& [7 U& psimple.StartSimulation(".Models.Frame.EventController");
g, N. s: V( z9 |2 x8 }
( Q- j: g6 U! a3 o) H+ `if (simple.IsSimulationRunning())
3 j2 Z# Q" Z, C5 V' _! F/ X5 M WScript.Echo("Simulation is running!"); & g" \5 }( ^% P& D/ t0 \9 A! j6 M* c3 O
$ l2 B( L0 p* O; ~
// Wait until simulation is finished 4 R; j Z7 M" W" C5 M' J! Q
while (!Finished) WScript.Sleep(2000);
8 u* Z* I* ?2 p) l) X7 _
2 O% y; E$ I" osimple.CloseModel(); , e5 P8 Q" D% w% y6 h- |! S
simple.Quit();
5 y# N6 X9 q$ u5 V+ A! l3 cWScript.Quit(); 6 _; S" J4 l& [; F1 Z6 P8 h
! p# `) n4 `9 _( Z: H; P
, `5 r: m& V+ {' Y- ?' ~1 jfunction RemoteControl_SimulationFinished() 6 N" t* w! f- h2 V
{ ' ^1 z' L; u3 {9 W
WScript.Echo("Simulation Finished!"); |