Example of a JScript s) N0 o& \1 F7 W
var vbOKCancel = 1; ( O4 O: |* O6 L! s
var vbCancel = 2; . z. K' J# y0 z* F5 W
var vbInformation = 64; : h) }2 t) W8 z* v! T) }
var Finished=false;
% M. O* Z) _: p4 x0 A) B ( ]% L5 {1 u" U4 {, f
var WSHShell = new ActiveXObject("WScript.Shell"); ! q8 Z3 Y/ r# Q2 `, N) v/ X8 {
" ]3 Z; T- r {0 H/ o9 b6 n) _var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; P) l% e! [* @" T
3 S* h. G' W; C9 Asimple.SetLicenseType("Runtime"); & y+ |* s/ Y2 s5 g9 M( J
8 x0 c! o' z: b
try ( K3 m! Q! k# ~. {4 p
{ 8 P' B( C3 g$ M0 j" h; F6 O& K
// Enter the path to a model file! / _+ Z' d" w+ i$ V( Y
simple.LoadModel("C:\\Models\\Test.spp");
6 ^: w$ D. x9 [1 ~} 6 z/ B0 t. k2 E6 M$ z! j( O
catch (e) 5 W! Y( P: {) H. P0 r& p5 |% A
{
# Z+ G1 q; M: x K WScript.Echo("Could not load Model!"); 7 q+ }+ E" I9 O; [6 L1 d" L
WScript.Quit(); ' s# g- k& C# X% x8 N) O
} / @$ C6 B0 p7 T r. ~ R
. z* f k2 u- V( R5 Etry
% z3 y$ a Z6 M d! J" B1 ^{
X5 m$ g% n$ } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! f& h0 w4 l; }1 J k! d! E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 b3 R: D0 i( m if (r == vbCancel)
o! k( Q7 t; P1 d { 6 I7 A6 T7 O# X. }, p* s
simple.CloseModel(); % z- I1 h4 ^* K
WScript.Quit(); # R( Y1 M9 s! {$ q) f/ W3 J
}
8 p; C: e+ G; a H8 p} 2 A1 Q) S* P9 p" R) d1 j" r0 _6 S
a* L% ?/ l- _ Ysimple.StartSimulation(".Models.Frame.EventController"); " Y2 g. N% B+ E$ g+ }9 L3 V
" o/ U/ f1 w* M ~) `) X" x% I
if (simple.IsSimulationRunning())
. L, ~7 K9 j, C% c( t4 I9 D; [ WScript.Echo("Simulation is running!");
/ ^# d) M, N1 ?) J# s$ l0 x" S# \ T3 v( @8 o v( d; g9 {
// Wait until simulation is finished ) J% v1 [# x$ u+ Z6 s
while (!Finished) WScript.Sleep(2000);
" t0 X& x. F/ v( P
; a( V w% q( \' c$ ksimple.CloseModel(); 9 S4 U3 g! C# Q1 N ]
simple.Quit();
2 X, L, y U2 Y8 [1 aWScript.Quit();
! I2 S0 P9 ^ W 0 a" d; A2 r6 C5 Y$ J2 `' Z
$ R4 Q/ r) X6 ]$ a% r3 |4 B4 v0 lfunction RemoteControl_SimulationFinished()
9 ?+ X- E3 u( M; Z6 V{
9 J; d: @5 r/ [+ D C3 A WScript.Echo("Simulation Finished!"); |