Example of a JScript " g1 K+ C5 e, `9 G
var vbOKCancel = 1; ; T. M) [* u* h. @
var vbCancel = 2; # I5 u0 M1 b3 t3 D$ i9 L
var vbInformation = 64; ( F6 J) f# \, k
var Finished=false;
, H! F/ U# `. p7 u; ]& M1 L, R! o$ x ! g, _) o0 y {. O3 K0 F
var WSHShell = new ActiveXObject("WScript.Shell"); . l; g" U/ b+ D& r% e! z9 |
' D# ^; i, r0 a8 Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. L/ P! Q$ X; I% _9 y8 R' o 2 I$ f* O* R$ c, a2 A4 r) \$ W
simple.SetLicenseType("Runtime");
$ E. c/ [ |$ I: t* A
) D4 t% i& T- O8 Ztry + B j, I# o$ E! A- @" u4 K
{ $ S! S6 g4 v2 z5 y$ `
// Enter the path to a model file! 5 a1 d' _$ g6 e8 U* y- ^
simple.LoadModel("C:\\Models\\Test.spp");
0 A* f8 n0 b' A: s, Q) q; ~}
9 F$ Q M8 ?; h( F$ L; i- l. Icatch (e) 1 }4 _/ \( r& |' R
{ ' V8 o$ M8 w- @3 T; k+ Z
WScript.Echo("Could not load Model!"); $ o( D5 j7 G1 h' C
WScript.Quit();
+ K" H- M- q7 M- B8 V} # B! Z& B, f/ K! |1 M! g V
F: A9 l8 u" `: l/ e+ h" c' v
try $ @8 L! { e5 R& y
{
5 U9 i+ ?& n- K' q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ E' Q$ ? t% A5 ]0 W0 p( i! |/ ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 M% B5 t& T5 ?4 E if (r == vbCancel) 7 C( @# g) m1 o' {8 ?3 R; c
{ 9 r1 m* x. d7 t7 s( A$ s
simple.CloseModel();
/ w/ u4 y8 e! j5 l& U WScript.Quit();
g7 `0 A2 p$ Q0 ^/ _ } % J7 P0 [( R" @
}
O0 l( K) V a s 3 T5 @' Q# o* e: ]! R6 n7 Z/ g
simple.StartSimulation(".Models.Frame.EventController");
) n) b; Y! c$ {+ K: N
7 }* ?- S% L8 ~( ]5 u- v$ \8 Q1 Bif (simple.IsSimulationRunning())
6 t& f: {7 R1 q% N. u9 C( w* { WScript.Echo("Simulation is running!");
1 @5 ]1 X7 C! U! L! c3 ` ! @" }1 z+ _2 v8 ^* _. \1 C, f R1 m y
// Wait until simulation is finished 2 {3 H8 k6 D3 _( I: M z# Q
while (!Finished) WScript.Sleep(2000); 3 G% L' M F& Q4 G
& q/ X" q/ \9 l6 F* N' vsimple.CloseModel();
2 \. Z+ @8 a e$ s2 o3 F9 hsimple.Quit(); + M6 u& s' e6 |" C4 f3 M; d
WScript.Quit();
) p. Y2 R& Y s% w) I2 S+ X/ Q) |
J2 s+ r0 i+ Y5 [1 a/ S
4 U% y; ^: e. f& ^function RemoteControl_SimulationFinished() . b/ B$ O; z4 L( E' J2 g6 E
{ 2 @, }9 Q* ?7 W3 K$ g
WScript.Echo("Simulation Finished!"); |