Example of a JScript ( i/ J3 x. _- @
var vbOKCancel = 1;
: V: [0 x3 U8 O! v6 ^var vbCancel = 2;
) _9 m0 S6 W# D8 ^. W6 Mvar vbInformation = 64;
% c0 v5 Q- A- Lvar Finished=false;
6 l9 b( x# h5 D( U9 u ; d) e( ?- K! R2 |7 j
var WSHShell = new ActiveXObject("WScript.Shell");
% r- F$ Q6 _, _9 A
1 w2 F8 Y0 Y! r! `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) K8 @% Z8 B. @, M! J- i
) u: e/ @6 h' m, l. q* Bsimple.SetLicenseType("Runtime"); $ v, V6 r9 i) [) {6 H6 e: G4 L. m) p
+ P, v- e7 S8 T
try
" p* Z o5 ~% p7 Y+ t{
. w6 j2 t: D1 Y9 T4 A, u! P' } X // Enter the path to a model file!
# ?, c2 u9 k9 B: i ]& k simple.LoadModel("C:\\Models\\Test.spp");
, ? _2 F" J4 t}
) j& x! v6 K6 L' B! w+ z7 ~$ L9 B" d( Ycatch (e)
* k5 Q0 X$ `( a, g8 V/ _{ ! T' R+ M, z" x) Z# w2 j
WScript.Echo("Could not load Model!"); 9 x/ D# }/ e0 u, _3 x5 m5 ~% @- M
WScript.Quit(); ( N2 X" l" E' X3 r- O T
} ) T( o2 Q* h$ i5 u8 p
, w4 Z$ _' Z7 D! Q, |3 M1 H3 g8 Stry 8 Z7 {& @) a k% x: V. J
{ * C' Z5 y) L& e. G( W. C2 w1 @
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 I j' P) m. t% z9 c- I
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , z {) R6 n8 I O
if (r == vbCancel)
+ E0 Z1 E2 f, s9 R+ M2 g { : }" P3 n+ i- g. |* u
simple.CloseModel(); % l) X2 _. ~ ?! K3 O! I) M# m, ~* x
WScript.Quit();
7 I3 O, o% ?+ J8 X) w8 ] }
( ?* w6 {: p( j1 a2 N}
! b1 g' a l2 t& t/ \2 A ! M& Z) T* H6 n( c
simple.StartSimulation(".Models.Frame.EventController");
+ n7 g$ p! G3 v. u! f* c
! n; R7 Y. X. t1 iif (simple.IsSimulationRunning())
5 ~) B5 V, d; F3 r( _ WScript.Echo("Simulation is running!");
% m# n3 y9 U- Q0 m* u
+ b, |2 ?8 V M. f% }// Wait until simulation is finished
2 n, I/ V5 @* t9 f$ U6 kwhile (!Finished) WScript.Sleep(2000);
+ \, ^4 z2 u' |: [, m , h) c* Q" E6 a6 @. p5 y2 c
simple.CloseModel(); . O& z2 D V$ Z; q" P! l
simple.Quit(); 9 R( p' `: r4 G, { R% h" h
WScript.Quit(); $ x& T% ~) ]6 _# g' l% _2 ?: T
* _4 a2 s2 \% |6 r/ A0 b. n
4 t0 [& z) B/ t! z3 ]! D/ M9 w( y# Cfunction RemoteControl_SimulationFinished() - |# m7 W, Q# ^5 p
{ 1 q* R/ c9 A G( j/ l2 P
WScript.Echo("Simulation Finished!"); |