Example of a JScript : S2 q& D( _7 Y6 b6 A
var vbOKCancel = 1; . I2 u7 y1 n8 F. l
var vbCancel = 2; 0 P3 a) a. ?% @, E
var vbInformation = 64;
n: ^9 G0 R1 b2 G5 p8 U* Y3 }var Finished=false; - U5 T3 v _# ~! a
9 `2 r/ D& ^8 F0 a2 t( ]
var WSHShell = new ActiveXObject("WScript.Shell");
1 B% ?4 u% s- V) y% b1 H
. f$ q6 \+ Q& K$ L2 ]# z! avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 C5 h8 G; z0 Z5 a) ^ ) z# h i( b% f8 Q5 H* E
simple.SetLicenseType("Runtime"); : B& S! M5 {/ H% u- f, u+ f) X
4 l# {0 Q' A- i- n2 Ytry ' t% g0 |& H% T+ ?; O' }: F; M q
{
3 U, a$ H J. y0 d // Enter the path to a model file! 3 W. }; | r6 I2 ]/ `" T
simple.LoadModel("C:\\Models\\Test.spp");
' i; Z- y A! P}
- I* R# l$ M7 O+ z: zcatch (e)
6 t W; S- u- b; y7 \{
, W. h, k& W) U+ u) I WScript.Echo("Could not load Model!");
# D& _, G" O- |" u% u4 g WScript.Quit();
# p9 b" @6 l! F& `} 1 `# C1 w( S. X) x* ]. f
4 o% w) p, q h$ T& Ptry
( |& B( _: U/ b0 M: e% o* c( E{ 7 O* ^( p: _8 U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + G( X- S: H$ K0 ]5 z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 {( H8 p' j- ?- @' E$ X$ c if (r == vbCancel) 3 o; t- {+ R, ]
{ " f- i) b2 g# G1 i
simple.CloseModel();
1 }2 [% Y0 U. H6 Z) \2 C4 P WScript.Quit(); 5 n" j" s2 `7 }; N2 j; E1 Q
}
6 }* T7 Z( u, ?6 F7 h- p} 4 {! h% U7 H" E# L3 W* g/ v
/ y) S3 J& B. a( ^+ z% l
simple.StartSimulation(".Models.Frame.EventController");
& u, b8 [! J$ V7 H! a: i0 B 9 e4 } D1 ^6 w0 l
if (simple.IsSimulationRunning()) % r# `4 l$ d. y
WScript.Echo("Simulation is running!"); % x/ z: Y" L2 g+ J7 W/ X' {7 O
; l- r+ h8 b* Q, ?. E// Wait until simulation is finished
5 z+ t. l4 v( z+ s _# Nwhile (!Finished) WScript.Sleep(2000);
7 l4 l, o2 [: [( a- H- m) O ' H. L- }/ Z. ^" S6 _0 U
simple.CloseModel(); - i1 \: B" g" X9 r/ q* Q) E
simple.Quit();
$ Y: ] i' e9 q. I4 T. eWScript.Quit();
; ?4 T7 G4 b8 v% l( `
, S5 x: r$ x1 k# b7 G5 a 2 s/ x4 }7 }* i( J
function RemoteControl_SimulationFinished() ! |, l" _6 x* e p2 n
{ / {9 l6 S2 f1 B7 Z
WScript.Echo("Simulation Finished!"); |