Example of a JScript
: D, P: U4 B0 a: L9 P: Avar vbOKCancel = 1;
! F5 _/ g7 ~* d/ Z9 W1 U; J! qvar vbCancel = 2;
7 c! ~2 h! s# R evar vbInformation = 64; . r7 C8 O% L& q% y- M& L
var Finished=false;
9 q5 p' x: r: ^, h3 o9 [8 r$ }. m
( R/ h \. c# uvar WSHShell = new ActiveXObject("WScript.Shell"); 6 E- I. P7 [3 } O; v8 S' I
* m" ~' f8 g: Z4 N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 r$ i/ R) [2 f$ W- I- x" P
0 x' n& l h7 \- t
simple.SetLicenseType("Runtime"); . O* b4 J7 \0 ?( n% H" T
) r) u$ H2 @3 ~9 ]) A& D }
try $ d, Z0 o$ U2 b1 m2 s7 Q
{
6 s' l% W$ `( u) Z // Enter the path to a model file! 3 V/ G: r) j) x6 D; i9 r
simple.LoadModel("C:\\Models\\Test.spp");
5 z/ F! A$ o( z- d- h} 3 ?0 O* t$ |3 I: y, h* E
catch (e)
, c, D* o! r5 f9 r) g( H{
8 `3 _- u1 ? s# m1 f1 j WScript.Echo("Could not load Model!"); 0 X8 g& [5 f: d* l9 }6 z
WScript.Quit(); 1 P* V' I! R4 K. l: h
} " D4 m4 P- n; W- p6 K( H; `$ H
% u1 s- S) G& J; F
try
: q2 p' h: C2 H4 W8 Q' \3 F; ^" k{ 0 Q* x9 n$ P3 W8 a. n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ c0 a$ O7 Y) a8 B/ C4 g r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ( k9 d# q3 H# }7 F0 h; w% X6 N
if (r == vbCancel) 1 E! t3 C3 V( _
{ 1 t2 y, s& W% u5 e G+ K5 k
simple.CloseModel();
. m: b$ [8 X, r( v9 b WScript.Quit();
' @; F8 i; Q1 e7 [3 W }
. O- |, C# ~5 R2 u* g}
$ L8 Q, ]8 I0 [4 e2 u* x
" T$ N- X" ?, E. asimple.StartSimulation(".Models.Frame.EventController");
2 \/ g/ o2 k& ~. D( A% S
' Z; Y; M" [( N( ]0 Z; A- mif (simple.IsSimulationRunning())
2 T( A, x- s' Z, z" \ WScript.Echo("Simulation is running!"); & B6 t) q+ Z2 ^' M
( D8 {9 a( f8 I, B1 `" r2 G
// Wait until simulation is finished
- Q$ h+ ~) E) U' pwhile (!Finished) WScript.Sleep(2000); 2 A) J+ u0 L3 P! q% a
0 I% c4 a! P9 L4 F; n
simple.CloseModel(); " y4 H2 c1 e- w7 ]; ~. h8 e
simple.Quit();
% ]% E+ j+ X. U! G# ^' O6 z" L' Z! TWScript.Quit(); & E0 s& e. j; {/ S1 e$ e: N# G
+ }, \) B, s- O9 I9 W
4 z# F& S( [" N1 a! ]function RemoteControl_SimulationFinished()
( m; F. R: N; ~ l. j8 T+ q4 W f{ $ |) [9 p$ v" A; ?
WScript.Echo("Simulation Finished!"); |