Example of a JScript 3 c3 m9 b5 C" F' X
var vbOKCancel = 1; . d- H8 J0 W2 ?. @9 T
var vbCancel = 2;
8 E9 z8 h b, Z) X5 Svar vbInformation = 64; % s* A# D) I+ A. [1 y0 P _
var Finished=false; / i0 R( I) ^6 A& i: @
- `* I7 t9 A4 U/ | ~: evar WSHShell = new ActiveXObject("WScript.Shell"); # G. ?0 F m! i9 r W- i
! m+ I, s, }* H) T" |2 ]0 avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 9 k6 h5 I3 T. q
2 d0 b1 x( `4 Zsimple.SetLicenseType("Runtime"); 1 [6 U( u7 W1 o; W
8 E( q3 D: r- c: P
try 7 E7 b R) Y6 c6 X* K5 r
{
& r" y' }+ f, Q$ L1 e$ { // Enter the path to a model file! - C7 h' q: z0 E2 C {) m
simple.LoadModel("C:\\Models\\Test.spp");
4 j: l( a: w2 |: ~3 ?6 F& ~& ]} ( [4 d3 S- X9 I3 i- ^) P
catch (e)
$ d# `' y' I+ C5 N7 ~- r{
2 Z* C$ s% v5 b" b" c% ^- w! i WScript.Echo("Could not load Model!");
" K g; ~: |7 L2 L WScript.Quit();
2 j' @) t! K; Q9 p}
" d/ A/ O, W( x2 X; p- T% Q* p/ [" X 1 m" n' w% {3 w) L
try
4 [1 x8 \" h0 o$ S1 F& B0 S5 S{ + `2 a) n2 i9 C7 s- j2 ]$ v4 G
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 D/ I. B6 s) x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % I7 Z. |6 P$ R% @0 l) _
if (r == vbCancel) 9 W9 ~% U7 D0 D! r1 {% I
{
' h6 `* T* Z1 ^; q simple.CloseModel();
) q9 P& l* o& |( M: C; K6 t WScript.Quit(); & s# `) P3 K3 M+ `
} " H$ x4 j4 b: t5 t# ^: q
} & a0 G9 F9 q, `7 o: h9 ~0 G% v
# w% q2 T+ z0 }
simple.StartSimulation(".Models.Frame.EventController"); 9 R% R6 l2 a: p7 d
' y+ c1 J( @0 T2 Z; U0 dif (simple.IsSimulationRunning())
: T! j; C5 h! D! s WScript.Echo("Simulation is running!"); 2 e! t% W0 k- A$ Y( u+ h3 Q
9 E" q0 z* e8 c: W
// Wait until simulation is finished
H* p! Q- H6 v. rwhile (!Finished) WScript.Sleep(2000);
. A. h: l0 o: Y) O6 [ 9 A& Y( p, C4 x- v+ {/ S0 i
simple.CloseModel();
9 ?3 i/ |; d2 U+ u( R) Usimple.Quit();
+ J& I; \6 J& G0 u9 E- p6 @WScript.Quit(); & E4 {' F& N" K# G
$ [# d" s1 d4 G( n, \2 h
6 _7 d$ W1 C# W$ f) m5 ?function RemoteControl_SimulationFinished() 5 c# S( L; P9 C1 F, N5 @: U0 J+ C
{ ) p$ J7 t& x% K# ~
WScript.Echo("Simulation Finished!"); |