Example of a JScript 6 p3 e8 E3 U Y# T. L- `
var vbOKCancel = 1;
% U, d! b5 C1 a3 X2 Fvar vbCancel = 2; # i3 m6 D# z2 d: }. m0 |
var vbInformation = 64; 1 I g6 P4 m/ d! y2 d
var Finished=false; , ~2 Y; o, W& j% q( n6 \
8 v5 u; [) A4 s8 ?, j% R$ Wvar WSHShell = new ActiveXObject("WScript.Shell"); 6 ~( _2 R% P7 x* f
* @* T1 m" z0 J( r7 t" b' ?5 H# Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! c# @! E8 {5 p& R6 b9 \) e
. Z; k5 ^- z6 _( a4 A
simple.SetLicenseType("Runtime"); ; o9 ]" s) y c9 p0 ]/ w% b6 I8 k
1 {5 h' T) D- l1 l! B, mtry : `! @; R- f, g, p: ~- p4 ?) _
{
0 L6 X0 [* v& C // Enter the path to a model file! $ [2 t8 v4 w) W! v3 g3 h2 D3 C
simple.LoadModel("C:\\Models\\Test.spp"); 1 ~, ~$ i% `/ c
}
6 |/ k- ?: ?9 y. ?& Ncatch (e) ) ?! G0 W- P. Q+ v6 D# R1 p. _/ t
{ * i$ R8 t6 I, r3 b7 }
WScript.Echo("Could not load Model!"); ' F7 Z& f/ y" o4 w! e4 [4 y& ^
WScript.Quit(); , m6 e" y% U. c/ s5 l) Q, k7 x
}
' P' U# ?4 l5 T
; V! u& j* w! G) T( X Ctry # I7 U; Q% h' h3 |- ]
{ % p4 O( U! \3 S+ g( H
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 E+ h/ H8 y- T+ r& O2 l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" `1 e: K2 z9 X4 h4 D- U if (r == vbCancel) / I" X. N, [$ Q; f4 I
{ % W% g3 q* J) d* E; c; J6 A M
simple.CloseModel();
$ }8 s N7 ^# }+ c( Y' X WScript.Quit();
o) N& e- R. N" q6 m" K, s- C }
{: n2 s# P0 _! `7 s; I} , v' P" |& t+ Q7 j
1 h o; }( D* [$ U- z" j
simple.StartSimulation(".Models.Frame.EventController");
! l+ N/ C4 Z0 t, F' O1 y! _$ E
* w$ a$ P6 v6 Z$ Lif (simple.IsSimulationRunning()) ! s9 g* }& ?4 M, i$ s. H
WScript.Echo("Simulation is running!"); # M: o$ t9 X+ V" A
9 J6 G# H' r% Q3 S( c ]3 @" p// Wait until simulation is finished
; I' ]; t1 g3 v5 p6 owhile (!Finished) WScript.Sleep(2000); ( u/ `9 x3 z. t. S
7 Y! Y# B1 Q- w9 L9 U; ^1 C6 L/ w; c
simple.CloseModel(); 3 v) b U0 r' c. [2 T
simple.Quit();
% W: R2 y4 S" @& [( IWScript.Quit(); : w+ j* }' ]8 }
' }% _# u( @/ P
6 p+ h4 X7 h3 t1 o5 gfunction RemoteControl_SimulationFinished() $ G, d0 d( F8 A
{
1 m7 k5 X7 N* ` WScript.Echo("Simulation Finished!"); |