Example of a JScript " C8 r- i# H# y+ Z
var vbOKCancel = 1; : x0 p* I$ v1 D( X# H
var vbCancel = 2; - `8 g3 b' o+ j' O
var vbInformation = 64; % Q/ g% G% D+ k5 J: [
var Finished=false;
- v# Q, H; A7 D2 U5 T& ~7 u5 C, _ & @$ B$ X* j$ ]' Y4 K% q( o. {
var WSHShell = new ActiveXObject("WScript.Shell");
4 c& t' M. R. W7 {6 J! d( g- t
. W' e1 A) \: a8 dvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 O7 w; g; x8 g& ^* j
, z" r5 | W& s( j% r: n" @
simple.SetLicenseType("Runtime"); , }2 t3 y! M; u* i
6 ]' Z& n. {: W3 H
try
: g2 i; p3 a5 R. J9 u. B{
# C" `7 c5 q/ P5 N4 [! ^( L, S // Enter the path to a model file! 9 I5 v) y0 {) p1 N1 q
simple.LoadModel("C:\\Models\\Test.spp"); ! [' C* V% _( d: m' R1 x) v4 O
}
$ l( w8 y) M. z1 q) ucatch (e)
T, b/ O6 N5 a5 f9 `{ + c/ I) t% K7 K' ?' f {
WScript.Echo("Could not load Model!");
B; n% E; h, m w& b WScript.Quit(); . u5 B: i5 C% ?/ X# y+ s- Y
} 3 t" W m( Q# i' V3 g: {; g: P
n# l* E) d3 ]
try
/ B$ a0 V; n/ q Q{ ) M1 M! r5 e8 U2 c1 L) }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; J% X4 V4 U" e2 p
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % S7 ^& |: y9 [( v
if (r == vbCancel) 4 n( ]- j; c6 d5 r& _
{ . ?+ c! r) S5 C
simple.CloseModel();
% @) g; }) Q, `' x& d WScript.Quit();
h* ?0 N/ @& }1 D; a } $ x5 J! ?1 q9 }6 d, J8 n% F
}
4 `! l, ~: c% } @4 k# J3 Y( p
0 g9 v) T# k9 q; Msimple.StartSimulation(".Models.Frame.EventController"); 6 D" I: h0 X3 o! `' h: Z- c
/ D5 `4 V0 s3 _( pif (simple.IsSimulationRunning()) 3 m5 l( `/ y+ `9 L# g; i5 J
WScript.Echo("Simulation is running!");
' ^; k6 [' @; C9 n7 W) ` j, D) k: q3 w4 s6 y# J
// Wait until simulation is finished
3 y: z( X& J& m& {( j/ `while (!Finished) WScript.Sleep(2000); ! ~ w! W! b( M
! @/ M6 t, `3 G& G9 b; t1 P
simple.CloseModel(); 7 Q' L% ~$ }- u( h
simple.Quit();
# K _: ?" {- T8 C- G. C" R+ n4 ]( qWScript.Quit();
+ {4 f, }: F0 |0 o: D( }. c4 r* \, l ) f0 @9 Y' n: M' }* D) s: y
: h# f- k3 z3 k' c( Y2 c" C. S1 U
function RemoteControl_SimulationFinished() " y" O- ]" H* S' R$ O! i1 c
{
5 P. b6 n3 `' B0 _2 H2 |. i WScript.Echo("Simulation Finished!"); |