Example of a JScript
# }- H% D2 d, Ovar vbOKCancel = 1;
/ K0 E O1 R6 u8 lvar vbCancel = 2; % x [) f! Q4 T H( j* q
var vbInformation = 64;
$ ]+ M. b* s- [( g5 ~var Finished=false;
, ^; X, k0 A0 J. k, I) c8 r! ]) o
; o9 P- I& l6 nvar WSHShell = new ActiveXObject("WScript.Shell"); + r& P. T* z2 [8 ~) Y) S4 g
7 h( t- F! s1 R0 z) b- jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ M7 |0 T M" D$ s& ? ) C5 l! ]0 p, S; I0 @
simple.SetLicenseType("Runtime");
) S2 D3 Y$ U1 {: d: c # J$ ?+ ]+ S8 ]! o$ K6 ?
try , S9 [' D( R9 Q' j
{ 5 m6 o0 Z0 F+ F6 s
// Enter the path to a model file! , \9 l! X7 B. Y4 M
simple.LoadModel("C:\\Models\\Test.spp");
! t ]/ a6 L& K: c} - E: k5 N: x$ ]6 s0 ` C" w
catch (e)
, N" F% c# _3 o( M4 I{ ( N' k' x/ Q* ?) @0 G- L: C
WScript.Echo("Could not load Model!");
+ y8 O0 `: }4 {' _ WScript.Quit(); " r8 N$ y& _9 u, h
} 6 V: z \; v5 b* d' E. O
' G; |& T3 c% D @/ Z/ Q
try ) u6 \/ h3 b/ q
{ ( @# I. x, A6 i* y' D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( [% h% F$ w7 q1 p. D/ }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 C/ P& ?' g f9 p7 }0 V. S
if (r == vbCancel) 3 c2 f7 B0 q% r/ X+ s9 k
{ 2 j0 F+ H! I/ M2 w
simple.CloseModel();
6 ^& C/ ^2 Z: w, { WScript.Quit(); + e- h: X. Y( W, A
}
6 h4 z& ~* ~) `& a& M; C+ ~}
6 Q. e4 y2 T+ i
9 ?- h% K; k6 j! j, D: ^- M( Bsimple.StartSimulation(".Models.Frame.EventController"); 8 |0 }. t$ I$ g, Y1 f
; h! [4 z5 z! V! q1 Q( u: |6 q
if (simple.IsSimulationRunning()) 1 z' ^/ _2 [9 `
WScript.Echo("Simulation is running!"); : y( q6 q x1 F& N+ U( g, \, h
1 M% t8 ?6 F7 I/ b: i3 F// Wait until simulation is finished # j- V2 a$ U$ k" l- ?0 L
while (!Finished) WScript.Sleep(2000);
; `! h4 V. b4 o! k6 E 7 m8 C/ [- Z1 V, G
simple.CloseModel(); ! }9 B7 L/ ^2 k; P; u* q" K
simple.Quit();
% D' Y9 D7 l3 R) vWScript.Quit();
7 W# c& N9 O5 l- I8 i 2 g1 I- E2 p3 b0 ~
, @+ U# T6 e+ a
function RemoteControl_SimulationFinished() % G8 w5 v6 ~6 G( K X6 x
{ 0 Y5 t: E) z$ C, l
WScript.Echo("Simulation Finished!"); |