Example of a JScript
1 v4 ~7 u. _- b3 \, V p. Ivar vbOKCancel = 1; 0 M* m* w; O b; f, O/ c) H6 x
var vbCancel = 2; # w, j/ b* u* P3 O& r
var vbInformation = 64; ( z* T6 w n2 p/ Y5 h+ R
var Finished=false; * n$ x6 s/ p. ?/ f# U( z: W3 u1 x
2 M/ f6 [* e; Y. Zvar WSHShell = new ActiveXObject("WScript.Shell"); ! E, n: z, ?+ p8 q! S4 A
6 U- r2 T) L" q8 ^8 W$ ]
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # p( o+ b/ ^" F
! D( w0 e# g) w. _simple.SetLicenseType("Runtime");
3 u2 O" d, O2 \6 I$ q& }* c1 O
- x/ C- z. [4 u! t9 I" N$ \0 _try
3 W# l/ |. A$ f2 a{
; l K3 u& j6 Y+ ^8 b // Enter the path to a model file!
: P- x' x z+ U+ F simple.LoadModel("C:\\Models\\Test.spp");
( p4 b0 x8 {8 l# Q! I3 o+ N! x; A: E3 n/ F}
) v( @0 `5 ~9 }( v1 Pcatch (e)
8 o8 n! B% F& d{ " b! {" ?. u8 Z( m9 o6 c W0 E0 r; { n
WScript.Echo("Could not load Model!");
S1 a% f" ~0 ^( k9 g5 E+ Q WScript.Quit(); . y D/ H0 o7 ?
} 1 D* U* g, `/ r9 {
4 i- @3 s. y$ m |2 wtry
3 i& E$ k- A7 E3 U; y6 Y" r% |{
5 u6 I; E1 Q0 M" l, t( o simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % L, H5 `( m+ L9 G3 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 a+ R! E" e% z6 R6 Y N" l9 s
if (r == vbCancel)
" `" H: o5 d( L8 s5 F, R1 r# ~ { $ ^' I3 d/ t! y/ {: P7 E( C
simple.CloseModel();
7 r: U, W. t& P WScript.Quit();
. k( R0 }' V1 v; K }
, H. c! \" J: C; Q+ L}
1 D! M* e# M0 ~2 @" e5 E1 s% M
1 E# k; P3 n' esimple.StartSimulation(".Models.Frame.EventController");
' @$ e2 M! g/ j; G+ q 5 X5 [5 ^! H6 `2 j/ v! h, x
if (simple.IsSimulationRunning())
( l4 F' d( \/ ?; ~8 \0 v& q WScript.Echo("Simulation is running!"); 1 n9 O1 t: v( F
# o. e( R. d& g% c9 k7 Z& G# k/ m+ q// Wait until simulation is finished ) ~4 E* ~) P2 j7 j8 t. `: }
while (!Finished) WScript.Sleep(2000);
9 G" K* m0 k9 q K 6 ` m) s! F9 m7 e% I
simple.CloseModel();
9 W: p3 i' m# Q4 V3 H7 R8 Ksimple.Quit(); 9 P1 f/ D t* E( l3 I
WScript.Quit();
4 D0 |+ m7 k( B/ p/ v% ^- |# a
/ K8 c" P9 k7 r+ e. ^3 G* q 3 p3 A$ W E4 h" [$ @$ s" [
function RemoteControl_SimulationFinished()
5 W8 t% p: F2 B3 E4 s{
4 J/ o) s. |6 C+ r* o1 g; ^8 F- y WScript.Echo("Simulation Finished!"); |