Example of a JScript
2 y- @& d) S7 @. _, t9 m& r" V& C5 Jvar vbOKCancel = 1; 3 Z' v$ h% u" u: B$ r2 @
var vbCancel = 2; # f' x* g% f- ]0 m2 s, T) T$ g
var vbInformation = 64;
. h2 n' n" L9 |; [6 m+ _/ ?* }var Finished=false; ) ~- X6 t9 }$ [; e" H: d3 r
; P3 ?( b) d6 x: P- Mvar WSHShell = new ActiveXObject("WScript.Shell"); / z7 X! X) m1 E; J2 c/ u* Y
1 \2 _: q* |7 o0 }/ W ], Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # y! G: C1 i) G* B6 _2 l# J
* n! w& Q, _, B/ i& x. ?simple.SetLicenseType("Runtime");
/ `9 t7 J0 l0 T9 }' Z. X1 k J
6 U3 y( e/ v( j! e$ q6 ]5 t0 gtry 7 O4 j0 R7 H4 o2 t6 W- y( R6 D
{ 6 w, }- g/ ? P
// Enter the path to a model file!
* d" d" Y2 s O9 ]9 C, x+ r9 P simple.LoadModel("C:\\Models\\Test.spp");
( T* X4 [( J8 g9 ~} 9 B W. \6 n; I. v! _+ I
catch (e)
7 ]/ b2 C9 m$ U& _) W7 h{ Z, N/ B: D2 R7 F- a5 V: k% D
WScript.Echo("Could not load Model!");
4 a2 V2 N2 u9 M$ g' y WScript.Quit(); 7 S3 ~" b6 y" ^+ }
}
4 ~2 n: b% {+ f2 ^. K
/ K+ d- n: i6 a+ l/ R9 gtry 2 K: Q0 F8 m& l% \$ \) Y' i
{ . [: n6 m( _- ]* T2 Y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 \% j( z' P" i% G1 n9 x- P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : e3 |8 I9 e+ F! I# I& L
if (r == vbCancel) # l+ z T3 P8 l; K
{ 1 _8 Q# s! `9 o0 v2 m. u
simple.CloseModel();
/ V' S. _0 M1 P5 T WScript.Quit();
( e& P1 v2 h: W W! M3 S } 3 P6 J# T4 K" P9 w( @
}
5 Q( o$ u2 i, `+ C: S9 t, `
( D G% Z3 C4 T4 X3 ^simple.StartSimulation(".Models.Frame.EventController"); ( p( `3 q; _: e8 G- L2 J# I
$ T) {! f Z$ s; D4 }if (simple.IsSimulationRunning()) & L) p! [% O/ a' u3 Y6 {1 ~
WScript.Echo("Simulation is running!");
. {, v) s6 _, I& m( b3 W8 D9 K
5 h; Q; {+ o6 A& i* t// Wait until simulation is finished
9 H% L/ C; }2 V8 r# s! Z- pwhile (!Finished) WScript.Sleep(2000);
% K; P: e3 n0 C- Z. `! t) t ! U' L. @( a( K2 v( P5 U3 J9 D6 V
simple.CloseModel();
% y9 w9 \! R: Gsimple.Quit();
/ F# u' {$ v$ ?- C" D. Y7 fWScript.Quit();
& z& h6 _8 L# t. F8 X: b
) L7 I" `4 x* K- ]/ u* K; V
9 @2 e8 H+ d: k6 T' u8 f2 o) zfunction RemoteControl_SimulationFinished() . v1 N! |2 t S/ ~+ v* d
{
* k% H+ J6 y `, Z WScript.Echo("Simulation Finished!"); |