Example of a JScript
1 y& }7 w6 w4 Tvar vbOKCancel = 1;
i2 t: C% K% V2 ?" V8 a7 ^var vbCancel = 2;
* m3 G) ^4 ^+ Q4 [ zvar vbInformation = 64;
' l' T1 x% }3 v! h3 B! M8 svar Finished=false;
1 N* q- v; I) G% g; L3 c
3 ]' _4 \4 A0 C2 Kvar WSHShell = new ActiveXObject("WScript.Shell"); / D6 K ^5 [7 J$ \0 v
' [, `+ [# Z1 \0 h P' {+ b" ~7 A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 F% F3 b8 K9 K) R" _9 S
) @: I& @0 v2 |/ r! Z4 [7 S4 A5 D
simple.SetLicenseType("Runtime"); 1 N; w: B4 W% g' `# s7 \- ?7 z/ Z1 ^* b
. a0 Y. m+ F1 u5 z6 S# d: d
try
0 p" w/ G. v2 g8 E6 R' F' n) u{
) x6 S& n2 A) Z- S1 d4 Z+ P- F; u // Enter the path to a model file!
- {3 {9 Q& x. S' r* v0 _3 ` simple.LoadModel("C:\\Models\\Test.spp"); + _" b2 h1 S) S3 [3 t) o
}
0 b/ p2 e' G$ a' l7 `3 E( W: Z9 Pcatch (e) , C$ k. r/ [% H& }1 @# w
{ $ h" s d/ |8 z2 Q
WScript.Echo("Could not load Model!"); 5 r# X+ n( s3 K# Z- P
WScript.Quit();
6 n1 ], a, }3 Y& A% D( c} & _1 R) K1 F5 z& [( \% |
; j! {+ s8 x$ d2 F( o, b Ttry
/ U( A0 W+ G2 s" F3 M* w- s{ , h( |& u- S4 o" |- o& x$ r$ {: A
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { l4 g" M. E2 Z4 E: D! j; b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); U9 o0 W# h* Y H ?$ k" w
if (r == vbCancel)
# ^- z5 O& v" i {
( `9 H7 ?* `% m simple.CloseModel();
2 a `1 y8 {9 O WScript.Quit();
% B$ X6 [- |1 [4 U% N5 r }
( ?2 ?+ z+ p3 b+ e} ! ^" @: P. ^, z( C& p
8 }7 C. W s: ?4 w! B; g' x0 Lsimple.StartSimulation(".Models.Frame.EventController");
) _, s# _& N3 [$ l0 x/ ~: w3 Q) w6 F7 q
* ]" `; x A) Yif (simple.IsSimulationRunning())
3 |; ~0 v; o% H( w WScript.Echo("Simulation is running!"); & s; y0 r- }5 g( y/ i/ |( t
. p! x, |' |3 ^6 p, C- p// Wait until simulation is finished
9 o$ F ?' U/ `6 ]" X7 ^while (!Finished) WScript.Sleep(2000);
# G6 b! F2 \; O4 [+ t % ~8 U Y1 t( L) E. g, M/ h# b
simple.CloseModel();
6 K) L+ R6 D( v2 V3 Ksimple.Quit(); - O, }' q* u; e- C% `/ b" H1 y
WScript.Quit(); 0 i7 {4 _" w( Q( S g8 m$ b2 y: _
: u5 Z% Z: A% E) T. @7 w
3 }1 m' e$ o" f5 h. m* ?5 nfunction RemoteControl_SimulationFinished()
% u$ k- h( X3 [, ]/ i1 M8 ^# F* B{
" D1 I+ l) _% |& G$ m WScript.Echo("Simulation Finished!"); |