Example of a JScript
8 n9 K3 ?$ \% Z' U* T# R; {2 Zvar vbOKCancel = 1;
: S" k$ h" ?5 b+ ~$ O% uvar vbCancel = 2;
, ], E/ n" y' Bvar vbInformation = 64;
7 h8 ?7 m- l- Z: }4 i& @* }var Finished=false;
3 p5 v' a* x% l' M* u3 i * V b; j, ^: _2 q+ A$ ] G
var WSHShell = new ActiveXObject("WScript.Shell");
2 L: M/ t1 V# u" v! g. d8 P7 F C; g0 m) B `4 c' D
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 A& k1 h2 f# T. g' m. Q, q
8 ~9 j$ ~% u) n0 J0 d
simple.SetLicenseType("Runtime"); 9 Z$ ~8 C z0 o. E; I
5 l8 P* P( `# X4 w. |
try
. \" n; F8 {7 ]; U- @$ ?{ * h, F- O3 R% v5 Q0 Z9 n
// Enter the path to a model file!
7 W- k) ~; }$ f' p! Q s0 M0 D simple.LoadModel("C:\\Models\\Test.spp"); 7 B$ `* Q+ F! @3 `2 v. X& I
} 2 R0 e9 W+ k) Y( J D
catch (e)
9 B2 g5 B9 H6 o+ c% A. V0 \{ 6 M K0 u. a1 m. v& F5 F
WScript.Echo("Could not load Model!");
3 d7 K: k. Q+ L3 | WScript.Quit(); , e+ q$ z5 R+ m0 c! \% |
} S6 _) X x5 G" A3 Z) d% \* K: U
7 `5 V, k! w; U, Ttry / z% y4 y; v# \) {
{ 8 }! I3 ~* _3 A4 o" w( g! T n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " M4 i* @6 D- J+ o* s3 C4 V. s
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); D/ p% J! ?2 l4 ]1 w$ I
if (r == vbCancel)
( d; L" S( Z8 Q& }4 w$ C7 P {
u- [+ u1 F$ b8 h+ D9 Y simple.CloseModel();
$ k) U; B4 u. p) W. E WScript.Quit(); # S; D( f6 {; \: y) W7 P- U1 K
} ; l/ B( V% b% w! J, Z' Z& R
}
" ~' V6 |2 A2 g: |" k, `& {
' M Y1 u% [' Q3 \0 j1 R! w1 h( csimple.StartSimulation(".Models.Frame.EventController");
Z, s6 C& H+ P7 p# o' }. `3 w
! B; t0 u0 G+ E. j" W( H$ aif (simple.IsSimulationRunning())
; x; H% j r, i3 v" A. }7 C WScript.Echo("Simulation is running!");
2 ^! N( @4 Q' s3 ^/ c
. ^, p$ x2 G$ [+ x// Wait until simulation is finished
% L4 Y; m7 W/ b+ rwhile (!Finished) WScript.Sleep(2000); w& X0 b3 }9 _ w& w% N9 b
9 A! u' m0 i9 v, i* p
simple.CloseModel(); 2 ~0 a& a1 h- d6 ~
simple.Quit();
7 _0 M5 J! S' \1 E BWScript.Quit();
7 e3 C f$ T3 A; t + D" R6 A7 ^+ e3 \3 ^1 `
) {* r7 S- ^' t8 m; E/ a
function RemoteControl_SimulationFinished() : D- I% ?( N) _ N/ m" |
{
+ j$ ]5 S- H f0 O WScript.Echo("Simulation Finished!"); |