Example of a JScript * _/ X' ~) O' P( J0 B
var vbOKCancel = 1; 5 f m4 `0 {$ J- \1 M$ M
var vbCancel = 2;
/ a) i' P1 f1 c0 n$ f0 z! C) Avar vbInformation = 64; : K& L) A: E1 d2 ^
var Finished=false; ) X( ?& l( o8 q5 x1 ~3 q
`! d2 F; m) |4 Pvar WSHShell = new ActiveXObject("WScript.Shell");
) m) _7 L1 ?5 ?5 G9 r0 l: D3 F $ [$ J9 Z/ J7 s6 z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ g6 F& d4 l& E& s7 b
- l1 [5 F8 n$ O! t- hsimple.SetLicenseType("Runtime");
4 B/ X c( r5 b; m& k' a& i; X - `2 `0 H' c2 W
try 8 c% \. @* ]& f# p
{
% s5 ?) T3 N0 m( q- L // Enter the path to a model file!
, Y& d2 h8 U, G/ Q! y: L simple.LoadModel("C:\\Models\\Test.spp"); * s9 V4 m& r Z& p7 h
}
. r( Q2 b$ {8 t. pcatch (e) ! `( g1 l: s! H. x3 e0 Z1 C
{
: K% }% A0 w) N' ~ WScript.Echo("Could not load Model!");
, J$ j7 W0 Q# q( t( u/ g WScript.Quit(); 3 U' `6 g7 [) ~1 M. ^' N3 p
} - [4 n/ P q1 a% I
% D Y; K4 |1 m& m
try
; u% T5 Z( B$ f0 }8 v{
: N6 v5 a. a& T! C' X" i j. t simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, E) u. C7 S+ Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* E! `& s; s4 L; s$ n4 }3 I if (r == vbCancel) , \# n- g' d6 G
{ 3 e- ^9 a2 G9 d8 H& T
simple.CloseModel(); " ^" c% J+ u X! ~) k: @5 [
WScript.Quit();
3 ?# ^+ O/ `2 o } O+ c. B& @8 V/ V. [8 @: x, z) x
} 9 D) s* c; Q; y0 ?: Y4 Q7 b; V2 K
4 g0 E3 ~% I/ s& c$ Ksimple.StartSimulation(".Models.Frame.EventController"); / Z, i6 E R6 U2 q; K! }% x
& Q' R! f$ [6 V8 e! ^if (simple.IsSimulationRunning()) P3 ^1 L7 F( e
WScript.Echo("Simulation is running!");
2 `$ b' }5 E, d; F8 { w' g: q& n; g
// Wait until simulation is finished # e% [4 x3 u1 p7 O% U( A2 f: w- n
while (!Finished) WScript.Sleep(2000);
E! I7 f, ~ ^9 ~. f& S $ \8 H: a; l s# j$ R( N6 L
simple.CloseModel();
: b6 X0 k% c2 R( ^: \& E* `simple.Quit(); " s' b( `; L, k7 w% |- g
WScript.Quit(); ' ]+ c, x5 U3 |, t' K" F
" j! X. } a! s0 [; ?' @' A % I3 M- J, g9 ~9 }+ q
function RemoteControl_SimulationFinished()
& ?& s& K; O" P. k% r0 @+ @{ T5 K) [; g3 ~
WScript.Echo("Simulation Finished!"); |