Example of a JScript . ?% B; r- U) I' p" [
var vbOKCancel = 1;
! Z" y; E' J# C2 u& Yvar vbCancel = 2;
' {. U# _4 M2 S+ uvar vbInformation = 64; 2 M" i9 k3 k: b/ X
var Finished=false; z$ C6 D7 @: T) r/ G# Y2 I/ u4 V
) @/ n/ i" H5 r. f) t y1 j
var WSHShell = new ActiveXObject("WScript.Shell"); $ b: ^9 O, g2 [+ B3 s, t: P8 l& _
[( y% |' v( q, A
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ m5 {% K3 ]0 d# G2 w
1 b9 U( T- d( bsimple.SetLicenseType("Runtime"); - W0 ?( X2 t |0 ^ C9 P0 `& o; V
, I5 H9 `# M9 ~/ G) X8 J& Dtry $ M7 W2 X1 l/ G& B. u( H- m
{ . ?5 v1 z8 C- W% k% a: B" J7 z- ]
// Enter the path to a model file! 2 x0 g# U5 Z3 h+ Y* x8 S D3 ~
simple.LoadModel("C:\\Models\\Test.spp"); " R8 V" Q9 V! D
}
: c! J9 ^' O1 h1 V9 ?+ \; scatch (e) " M& r5 |) Z0 _* \' Y% z
{ ; ?* t7 o* S2 w- V
WScript.Echo("Could not load Model!");
4 q. ^1 c6 Q6 ^ WScript.Quit(); + a0 p/ k" v+ K3 a
} ' E5 X: }! [0 n. V% q
$ l% I. x! o; t
try
6 K5 P/ P' x, J( [# X{ 1 E$ H# W' x7 E
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - S) d7 H- R4 G" E% M& l
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
W4 ^ E. x6 j+ J6 C4 m if (r == vbCancel) 2 u7 d' ]6 g# ~/ w7 ?+ ~
{ & O8 Q* E4 t' L8 S5 B6 q
simple.CloseModel(); 0 Z [ y6 A( T- L: D
WScript.Quit(); ' R! P3 S# `/ Z3 |, H
}
" Y1 X8 `5 E& ?; }# e} ) V b0 i* p2 k- s% I4 Z' T
( J( {/ [+ M* f( E; j# ^/ e: zsimple.StartSimulation(".Models.Frame.EventController");
' N* d8 R g; [ 8 b; Q* R& i6 D) B* ^7 }
if (simple.IsSimulationRunning()) 2 G1 ~( u# K" n& S1 s5 P
WScript.Echo("Simulation is running!"); ) [6 W& ]5 S R& f, ~
! R. b7 r4 t% J2 v. g5 B// Wait until simulation is finished 1 x' d9 {+ q- Y" P( _2 x1 j/ M) {
while (!Finished) WScript.Sleep(2000);
% v& F* O6 z+ I6 _ / s: n" C, T4 L( Z1 \
simple.CloseModel(); % v* R N$ [ E# P& r! ?2 J7 O
simple.Quit();
2 L8 R, z7 h2 V- e; FWScript.Quit(); ) m! b9 o. M5 V3 @3 R, Y! W
# A3 F1 o0 H2 O4 z
4 z/ a: s. `- `9 ifunction RemoteControl_SimulationFinished() 9 |& b. b* H1 h% ]2 D: A2 Q
{ + y4 j1 q/ S% p% D* Y
WScript.Echo("Simulation Finished!"); |