Example of a JScript
8 B( F! ?$ ^# A1 ^- Lvar vbOKCancel = 1;
) M2 `, W9 W; t# ~0 z |var vbCancel = 2; 4 j$ Y) v8 }+ x6 }( z$ u+ n4 @
var vbInformation = 64; & Y& _# | W, @; ~) b* R9 C
var Finished=false; ' V1 s( f y! `" ~ k3 e
# n" V( Z5 j( _% W9 a9 Uvar WSHShell = new ActiveXObject("WScript.Shell");
# A6 |3 l2 y) Q% h: U- w2 ` + J6 H$ \" m s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, P( E# Y2 w M; t* x
" I# L% r5 L( Y" e, P" Q. G2 Dsimple.SetLicenseType("Runtime");
; @. f% ?/ H% E % i/ v0 J% O+ s
try
) c" I" m9 ]7 [3 |' r/ G{
/ O% p# L8 `. _/ y) W // Enter the path to a model file! / G9 }2 ~; ^/ }5 x+ Y9 d
simple.LoadModel("C:\\Models\\Test.spp"); 3 g; s$ Y( z0 W) H I
}
' J' B% d2 M3 r- y. Ycatch (e) . c9 O) X1 O! n8 W$ T
{
( y* z9 M3 ~6 C& z& \ WScript.Echo("Could not load Model!");
2 W+ U: H$ J2 T- R0 v0 x# I WScript.Quit();
" S( p. t O( ~} 9 H" T! P7 Z* d5 `
2 T0 e V' @) z( ^, o
try
. O, ]! o+ I' m& v% j3 i{ % d6 D) q! {6 ]. K: z+ n4 ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 Z/ `3 F6 ~5 s8 J% @7 q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 v% z6 B% }8 n3 l9 f# a2 K4 j
if (r == vbCancel) ( J, s- L* ^, y+ M! ~5 ?
{ / t& H3 ^9 F6 G: c! Q, T& v3 r$ }
simple.CloseModel();
. u1 Q6 t4 u% i0 a" w WScript.Quit(); 9 k" N( r5 |# g P% ~7 o
} - f/ F/ g% ?# E/ m, r+ V5 {
} # u7 s' e' U/ j) b
0 L/ i% ~, J- _$ P! qsimple.StartSimulation(".Models.Frame.EventController"); . [. k9 ~, I6 B
# V" X9 a" p- Q' c6 ] W5 I: R
if (simple.IsSimulationRunning())
e0 E9 i' k$ Z WScript.Echo("Simulation is running!");
# q6 l, d+ k- U- [) X
1 X: E, y' @3 F0 O6 ^5 |+ \// Wait until simulation is finished * q8 [" q. R5 @2 f% r: F
while (!Finished) WScript.Sleep(2000); Y0 m. D$ O4 O% D- y8 ~& y
U) f) U6 s J. k2 S
simple.CloseModel(); 1 K; {8 ]7 I! L: }/ G
simple.Quit(); 2 V5 d( H' s/ F9 X1 F) m7 C0 j
WScript.Quit();
& d7 E+ ^6 q* U, \' G
" U. u1 i l! A! f9 U" O: U# Y
W: i0 Q _7 L7 P Gfunction RemoteControl_SimulationFinished() n& Z( O9 h% w2 y& z. y
{ , ]" T% G, ^7 C" `' L
WScript.Echo("Simulation Finished!"); |