Example of a JScript
1 F: ^9 ]1 e2 C& [var vbOKCancel = 1;
: E7 i- n5 z4 H$ j9 c- |; }+ Rvar vbCancel = 2;
5 _5 I" E4 c( _! Cvar vbInformation = 64; . Y0 D4 ?# l; T" ~2 b
var Finished=false;
' d! c* j6 P# _& Y+ _
/ d/ T+ ]* m% j9 T% m. Avar WSHShell = new ActiveXObject("WScript.Shell");
( D5 n; ]# j( ]5 \# B1 n 2 |4 h, m# U8 K4 \2 B: h0 d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' l' u b; l r7 `8 h
4 E J! C1 N" d {: B+ ~simple.SetLicenseType("Runtime");
9 w; w; l) ` G! |1 y / U. }: ]+ Y x0 ]; {
try
/ U0 y& Q! u- `5 G2 @# g{ ( C0 O. i9 b" U J
// Enter the path to a model file! ( c4 m4 B& c, Q$ ` e5 Z
simple.LoadModel("C:\\Models\\Test.spp");
! q4 Y/ x) U6 u; s. D} . D# n, G% z: ?& ~ X
catch (e)
4 ]: }5 j3 h9 ?6 ]" ~" \% ]{ ! M: D: ]8 _5 X' y8 Q
WScript.Echo("Could not load Model!");
( `; _; v$ U: k0 l) m: O5 j WScript.Quit(); - Q1 J# O# v4 _
}
- U! ~8 j: Y8 {8 ~: P" K5 z ; B) ?$ @2 [! d# v: C3 o6 w5 e0 A
try 4 E8 O' M% I2 h$ L) K
{
2 y0 \/ d5 T% k simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 ^8 x P2 I5 U t' l) {( o
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % P5 j: h0 r9 _$ [1 R
if (r == vbCancel)
, n% Z6 y5 O( N! [# n { ! b0 L* o+ X/ `9 Y6 Y
simple.CloseModel();
, x. k3 J" i$ ^, l! a* Y0 F WScript.Quit();
. ~5 `6 G3 f* v) O7 r) `+ ~ }
- `% z+ W v* i" ^; \7 H}
. b4 |& ^3 Z6 [" j
' a4 L8 N3 z, E" g7 H( ysimple.StartSimulation(".Models.Frame.EventController"); ' M( n, G- \5 F3 B
* {! Z0 g t; {( V+ E
if (simple.IsSimulationRunning())
4 G( `" l! P/ p/ W _- _/ G' ? WScript.Echo("Simulation is running!");
! X2 Q6 ^: I" a$ a* M1 F
4 s1 U! `4 ~* W, d3 ^/ s$ b// Wait until simulation is finished 2 Y: _0 ?6 m" M7 v
while (!Finished) WScript.Sleep(2000); / s& h. A" I1 [8 N
- b& p. q% @- r7 X& Rsimple.CloseModel(); ! d) }, [0 a0 l
simple.Quit(); / Y. c; j# I! J1 q a
WScript.Quit();
6 Z" z% E+ V8 O; M- M( n U8 l
% s4 H6 Z) e2 \* F; |" L
: L' T3 r9 h* R! ? ]function RemoteControl_SimulationFinished() ) m9 H. t: U, ^) ?( T5 F
{
& u0 E t! K1 w% T4 [ WScript.Echo("Simulation Finished!"); |