Example of a JScript
- Z; | o; l) N: @: C. ^var vbOKCancel = 1;
7 p1 H% i. X" Z1 avar vbCancel = 2;
1 D2 x- ^1 @8 c* c- Z4 avar vbInformation = 64;
' n' C) b* M) z ~var Finished=false;
# [ t, b& s. w; Y' }2 h% n) X 6 d. B+ h( q; U4 v( i8 t6 u+ V
var WSHShell = new ActiveXObject("WScript.Shell"); & l8 f( [1 f( B( X
& T$ W* y$ _! Q$ r- X* A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 6 Q' ^: e; b4 }: I w2 u# \
1 l0 ^' {! K. J) R7 G! bsimple.SetLicenseType("Runtime"); ' ~+ r- r$ D. V( Q
) M& r" b) l' B; w
try
" z p4 K% M, K2 |& w{
1 x4 v( f+ `: Q" y1 Z // Enter the path to a model file!
* d! f! ?4 B+ \( }2 H simple.LoadModel("C:\\Models\\Test.spp"); + g# V8 V0 @2 r* C
}
# S+ `) J/ `1 h; V1 tcatch (e)
8 T, i2 B( _7 f* j2 u( z7 C, O1 h{
* ~* B" D$ u* |+ ~4 X WScript.Echo("Could not load Model!");
$ D; b Z* D6 Q/ b WScript.Quit();
0 l, ?$ k6 d, ~4 G) x5 c} ) h! a9 P8 q7 G6 N" g0 K) U
+ @/ I( H+ h; U+ o; _9 w
try
7 X! T W* K. d( r. e3 i1 D{ ' B5 X8 a R4 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 ]. U0 B/ K2 I* P1 }/ T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 X8 w6 ]" ^. C$ }, H0 k if (r == vbCancel) % @# E5 g2 n7 s; m9 Z$ ?
{
8 R# K* v: V! @' {6 q. D( I simple.CloseModel(); 1 ]* s# t% G6 U% i9 L( Q" u
WScript.Quit();
$ Y7 T: S, e% s$ P% a% k } . M( f8 B. Y* F2 ~+ Q
} " G3 C/ d ~+ K5 U
* R" d1 Q1 Q5 D8 Q# ~: v \
simple.StartSimulation(".Models.Frame.EventController"); 9 P' @* w; \. x7 Y: t! D, @/ N- A# Z0 }
" ^. r& f. n& V7 D
if (simple.IsSimulationRunning()) 2 _2 r0 S' z, d, m
WScript.Echo("Simulation is running!");
. x6 ]+ B% [. W4 Z) m3 C8 b / O: f& a, ?& l- G3 B: T
// Wait until simulation is finished , N7 i9 l$ t: F( E ~
while (!Finished) WScript.Sleep(2000); % n- Z$ M7 S9 D6 c8 G9 }2 p
! \9 Y2 R# Q2 i: u. Csimple.CloseModel(); 6 |0 O$ S# E& f$ w# n
simple.Quit(); , d$ H2 \ ?8 [5 W+ R
WScript.Quit();
7 | T2 S+ O1 k! B0 h5 W5 R9 w( T$ L % w3 v3 h' l" c2 C# ^# Z' X4 Q
( G1 M8 h3 `/ q0 v" X
function RemoteControl_SimulationFinished()
* N) b3 p1 @3 T( y" l, B{
; S/ o# ^9 `, b- M' P WScript.Echo("Simulation Finished!"); |