Example of a JScript
7 Y+ g% g# x7 _& M+ bvar vbOKCancel = 1; 7 C( c I5 B9 g) }' y, }) x6 r% f2 P
var vbCancel = 2;
! I( |# U5 s0 B% jvar vbInformation = 64;
* l! T) u- |- t0 e/ svar Finished=false; + b" D; I, c2 } I4 \% X/ x
; T; n; `6 y T, C
var WSHShell = new ActiveXObject("WScript.Shell");
* `- `9 \' }6 w* N, T
9 ^ }; _; k* A L; Tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! ^# W' n; |$ C3 \) r8 L. G# [ " L9 P: J6 }) e; _# Y
simple.SetLicenseType("Runtime");
& i" f+ N8 f3 o1 ] * t, J/ P5 O9 A; w7 x' ~# n
try
4 b% F4 n3 R2 f& p{ 6 Y0 P; b$ I1 t2 }. j6 l- k
// Enter the path to a model file! ! x/ |: k5 m5 E5 w. s/ ]
simple.LoadModel("C:\\Models\\Test.spp"); . R2 k+ J+ t2 v. D
}
4 T* j* w% e, n3 icatch (e)
6 u# G- I. h: _; z+ u( G9 u{
7 o" x+ ~# e( f WScript.Echo("Could not load Model!"); . p% N9 A. _5 ^( n2 x
WScript.Quit();
( C, q6 }0 M" u- O9 O$ Z}
7 Q6 P& o# p9 K( F
; s% z j, D6 o0 H. xtry 5 B1 C; O3 j1 F5 ~* b u& n+ R: }
{ 0 Y/ d2 h5 B2 \" r3 l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; }9 y* L. c1 g- s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. x4 z: Z' N* _3 { if (r == vbCancel)
0 `6 Y2 x8 |7 ?* O( S; h {
) J" V* I. p# N simple.CloseModel(); 4 x/ z# V! T8 Q. Z$ w8 E
WScript.Quit(); ) |) k" \) X9 G( L
}
; \: f. \9 u- k}
( P. n; g. ^+ ?
: I( a* O1 Y$ e E2 P7 @3 b8 fsimple.StartSimulation(".Models.Frame.EventController");
. K/ g% q8 L' Y( S- h# O+ M; k4 R
# L: X1 I: |0 d0 Jif (simple.IsSimulationRunning())
, {3 |: O5 F6 x3 R! E0 V/ N: L4 m WScript.Echo("Simulation is running!");
) r# a9 m l/ B* _! ~, j 7 e4 y; D+ j; H' Y- E" h6 C4 C
// Wait until simulation is finished 5 |% L8 G5 \- ?5 y; t
while (!Finished) WScript.Sleep(2000);
3 H+ t, B! e. @9 V) f0 A d
* f' w' H4 c+ W% J+ \9 p9 ]. Msimple.CloseModel(); ' O% ?/ @- g# m( ]) L& S4 n
simple.Quit();
( Y, s. e- V1 Q; m/ iWScript.Quit();
# q. {: F" n6 @; a/ R$ g
* f3 l0 d- a7 ?& R 5 z) m* P9 _: z/ Z w# ~, F! g* L
function RemoteControl_SimulationFinished() . |( A$ S- ^4 }. `
{ - W* A% u1 Y" R9 ^7 M* Z8 l! C4 n
WScript.Echo("Simulation Finished!"); |