Example of a JScript 3 h1 F% l3 N& E9 @! b3 L, w/ k" H3 d
var vbOKCancel = 1;
' r& `9 E: G0 I" X6 `* [/ E/ Nvar vbCancel = 2;
% ]1 [0 `! H6 }% U& D6 v: n) Avar vbInformation = 64;
2 Y+ B, b1 _; i, Wvar Finished=false; M4 D- P; f& B9 u/ v& O$ @
+ V7 C) {- }0 C. [0 C% h
var WSHShell = new ActiveXObject("WScript.Shell");
$ h7 [3 r/ j$ v. U4 n3 [ 6 w M' G& v! \( b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); H$ R- D+ w/ A1 B7 u
; ~! V, C. I0 w9 d2 _1 {+ }
simple.SetLicenseType("Runtime"); 2 G$ U( S' b, t; Y% I z0 G3 D% P
$ j# u8 T1 S: g' b9 ]% i& {try 3 l( G( b$ ?1 D* e4 L/ ` B
{ ; E+ N% {/ K$ p
// Enter the path to a model file! , i* O: F( J7 s
simple.LoadModel("C:\\Models\\Test.spp"); ) z; j5 m% K9 m# y! Q
}
% N$ Q3 w$ A5 B0 N/ H- i! c. ycatch (e) 9 G% ]7 J0 ^- p
{ / S/ |# g" j$ B
WScript.Echo("Could not load Model!"); 9 g7 c9 H. r2 p$ N* B' O/ L# [0 \
WScript.Quit();
$ G4 ^/ I) ]- ?/ Q) f; L}
( M# ?3 ~$ E* e' [) p
5 c5 ^0 v3 P4 u* T0 t) G" dtry : X2 `/ y5 I" w P8 \$ H$ j* X
{
* C/ U; l# \: { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # X: ~* j) k: b0 j& E/ k$ T* k! f
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . {" w& T, u( Y# C4 j n
if (r == vbCancel) ' C# r/ }* i( u" T
{ 1 ~. h& e9 O5 c# Z8 c4 E0 u
simple.CloseModel(); ; m6 ?1 h1 o: s& v6 Q3 L0 q! v) @* P
WScript.Quit();
' Y; L( [9 j- I( c+ U/ @1 _ }
0 e% z3 g0 V, d( m} $ W: W- y' |$ }
2 J1 A; |" f5 D7 {
simple.StartSimulation(".Models.Frame.EventController"); ' h$ U" I) D/ U4 V4 y9 Y
+ e% N1 C; ~+ I) ^4 D& p0 ^7 Q
if (simple.IsSimulationRunning())
/ t) H8 g8 ^6 A+ H WScript.Echo("Simulation is running!");
/ l9 h. D) M; n; ?4 e. G ' z! Z# @$ e* d$ O6 e4 ~! g; v$ V
// Wait until simulation is finished
6 F1 d ~+ q* l2 `+ p( B( y5 P8 jwhile (!Finished) WScript.Sleep(2000);
. _8 X1 q3 C3 J3 k
8 n0 H1 x9 E( c; _5 Z) Tsimple.CloseModel();
% X `) v% I$ [$ x% Hsimple.Quit(); 5 h( X0 ~( q6 o& i+ d( v2 @
WScript.Quit(); 5 I' ~4 i6 C; t7 S8 L; C" {
, t) J6 G9 {' @( h + e! p# B4 C$ X& e; S' z5 k
function RemoteControl_SimulationFinished() 6 \& l- Y m$ [# B; q* ]
{ * {+ N9 z7 g- D2 D @
WScript.Echo("Simulation Finished!"); |