Example of a JScript 3 K& r1 F, Z: N# k! ~- U+ V
var vbOKCancel = 1;
$ l W7 e( t+ t! Hvar vbCancel = 2;
! q/ z7 g9 S( h. E$ tvar vbInformation = 64;
- }3 m8 B* x* v1 e- m1 Kvar Finished=false; ; i3 Y4 V( p# d
% Y" `# c: C, d1 \+ r
var WSHShell = new ActiveXObject("WScript.Shell"); 5 v& H4 r2 k+ H* `! X" D' H, d0 z
- G) k5 v7 c9 T9 O2 u- w
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" T8 N- E9 t. x/ P
0 m$ F+ `2 {! m5 f: f" ]2 Lsimple.SetLicenseType("Runtime");
, y# h2 ?7 p6 n& u3 H/ ? ' d$ i# o0 K" K1 R3 h; Q, K) U( c: c
try 8 l5 r1 a5 T3 `, ?# O
{
9 J* e, r! Q1 U# z // Enter the path to a model file!
0 h8 Y1 v- `' E- { simple.LoadModel("C:\\Models\\Test.spp");
" o9 C L/ |9 F" w* v} " D' t8 N- o) P$ g6 r+ E
catch (e)
* ~! |0 ?7 C$ s# H{ ! @3 M* ~0 s9 O& ]5 m: ^
WScript.Echo("Could not load Model!"); 4 j% i5 X7 P+ Z, Z0 w
WScript.Quit();
- g U2 O, D$ u6 D& T& N} 2 ?0 f" `) j- r" P0 m; P/ b4 C3 u
. n( P: ?0 X+ H5 U: z. C. N2 t
try : ^: d( h% Z7 I: j- O0 e
{
8 g- r1 C1 h/ u simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 }. e7 w0 c- l+ x( q" V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 f; ?0 c3 w7 F% \' f K if (r == vbCancel) u8 E) T3 ?+ o" \8 l6 x
{
/ f l! Z8 H5 C simple.CloseModel(); - a3 d v! S& y. g) S* V2 G
WScript.Quit(); . z: \& ?3 k& ]/ B' h, z6 y
}
7 e2 M) E; Q1 p( S} : o$ D' ?8 F6 g! p2 E5 w* B
( }% }, q4 y. K) a W% ~1 j$ esimple.StartSimulation(".Models.Frame.EventController");
|8 A" F4 _% b- L7 u/ p, M
+ \ b2 J# \" Z9 _5 Yif (simple.IsSimulationRunning())
, a& a" W- e( o& j WScript.Echo("Simulation is running!");
. A& r$ ?# L ~) o
2 {: j! }& k2 X. o2 b, p! O// Wait until simulation is finished 8 h9 h6 w) _" ~" ?0 o
while (!Finished) WScript.Sleep(2000); # j) h" v7 M* i% Y& E x* V
" `0 E% e7 F5 G7 N. v3 R
simple.CloseModel(); 0 r& w) u5 O t( }; D, \
simple.Quit();
, ~9 ]/ p/ [8 A; CWScript.Quit(); 7 L- \- \' ]- q/ F3 H) b
/ \7 \& ]% @$ j% ~; \ 3 J- E6 D% b* p
function RemoteControl_SimulationFinished() ) k1 B7 C s+ t- w. ~* f. C2 F8 ?5 x
{ ) K! L8 j* W$ x" \6 h+ g
WScript.Echo("Simulation Finished!"); |