Example of a JScript
$ Y5 w; ^$ U6 w1 F6 `. mvar vbOKCancel = 1; 0 s4 Z( P; O+ h# |
var vbCancel = 2; 9 Z/ @0 }5 A/ M4 y- }! K# D: a
var vbInformation = 64;
* x; Q# T& A ~1 }/ z2 n2 r3 ]var Finished=false; * _! @/ \. u$ w3 X: c4 _
1 t% A3 U5 N# w$ Y! j6 h# I+ }* T9 Tvar WSHShell = new ActiveXObject("WScript.Shell");
7 l% _8 U, ]( a, t
. w/ Q0 k4 E4 E8 @) zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 l8 d. d; h7 D! U
, ^2 U5 ^/ P, F$ f0 ?# Y
simple.SetLicenseType("Runtime"); % e$ |4 w: ?2 g2 B
7 X' m( R9 m# y l& Itry # W- G# c$ m: J2 @
{ ) n4 @3 r/ ^9 t( u9 e- o. ^) ~* t
// Enter the path to a model file! 8 L; ^( B A1 w3 b g; @: n0 o
simple.LoadModel("C:\\Models\\Test.spp"); / ?5 h9 M4 N% S0 E* x5 Y
}
6 y+ q8 O# C2 E/ W' bcatch (e)
3 |1 k: |8 i; |* ^9 r1 `; v6 q{
+ I) D4 y* Z, Q9 u+ H' f) V WScript.Echo("Could not load Model!"); * |' }# j, k( w
WScript.Quit(); - H+ p$ G9 {* T) ~# ]
} # \- C' v3 f7 Q1 J5 m- @
3 a9 c5 p! A9 |5 h( O- w7 _
try 7 s- v( ]" e6 [5 @, T
{ ( K+ A) r" K. d- s% U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- K4 v# T0 k# D! ]% U* n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
S6 ]$ p+ \6 m% g1 Y3 c if (r == vbCancel)
8 A/ L5 ]- M% h6 t { & Z5 O: K# W; H" B8 k: ]
simple.CloseModel(); " O/ f, B5 M4 d3 S; N8 P$ \9 {
WScript.Quit();
8 ^, J) X8 h( _2 }0 k }
# K& c' d) t0 G7 z}
. `" J: y+ b4 [! t$ }
Z& f7 b3 _: i9 R; fsimple.StartSimulation(".Models.Frame.EventController");
- T g n3 }# \: n5 B % X r$ g2 p' O! s
if (simple.IsSimulationRunning())
* z' L7 O6 C7 b0 W" o WScript.Echo("Simulation is running!"); * @# K8 T% y% g4 r3 Z
9 b4 a3 n. u' ?! Z0 ?* ]1 J
// Wait until simulation is finished
7 O. a3 f9 N( r% Y; lwhile (!Finished) WScript.Sleep(2000);
$ [ x+ e8 j( S% _& I% `/ _* ^ 8 x; i' L! D+ J# C
simple.CloseModel();
7 _# B% u% j3 @" z$ n% Vsimple.Quit();
, p9 h8 v' U- A" mWScript.Quit(); 9 B" l7 G9 d, F4 J0 c1 ]( ?8 G
) N4 b/ h3 U1 n2 a: n! B ' N5 \3 c% S* m+ n7 j0 r5 }
function RemoteControl_SimulationFinished()
1 F& z. g/ m4 F5 a{
9 `' j, J* d+ W WScript.Echo("Simulation Finished!"); |