Example of a JScript 7 o K( V# _3 E" c* `" z0 V. B- E) ?- d
var vbOKCancel = 1;
z! h8 M' V5 Pvar vbCancel = 2;
# c8 h h0 `' A, Q$ A2 Z# P3 [6 fvar vbInformation = 64;
; S$ v4 Y. P) e% s8 @) wvar Finished=false; - Q; h& }( m/ P4 Q4 E& G! A
# |1 ~% Q G! Nvar WSHShell = new ActiveXObject("WScript.Shell"); 8 p* x; f v- R% R" H
& C& K! c6 V' b" F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 Y/ J! \" C, b4 U: H, b$ P. n# A
1 t1 o6 S5 x& |+ }4 \simple.SetLicenseType("Runtime");
0 p# C2 X* U& x$ }$ I7 {
# w( K/ z7 {" m3 N- C# o+ v9 E. Ctry
2 ?( @: w+ j# \8 c) s4 }& {) d{ , o! w- ] p: f. b' O' m: [2 `( K$ r
// Enter the path to a model file!
7 U p9 }, m( q, ] simple.LoadModel("C:\\Models\\Test.spp");
( g7 C Q6 s. H- p1 ?}
0 |: H$ H K7 @! mcatch (e) 3 S4 j' W/ L3 Q0 \
{ 4 q4 D1 W( Z9 T4 L4 s
WScript.Echo("Could not load Model!"); : j+ `( u5 ?8 B; ?, V! z+ ~3 q
WScript.Quit();
Q" q% |1 d0 J6 \}
7 Q0 n. `7 _$ Y( U9 o/ a7 V+ a
: i- s; H9 G4 ]: a9 z; y# ], s/ Atry
1 L, l0 G T( J; I9 }{
n- q6 `6 y/ _4 B6 X simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 h4 z5 N4 j/ |6 O5 ]" s3 P9 e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 O; k* ~' v( N) }+ o) J3 |
if (r == vbCancel)
; M& C1 ^1 x7 v: o6 G- i5 x& L {
+ D$ |8 E1 o9 D0 B; k simple.CloseModel();
2 s9 Z; H% X' C: {' S WScript.Quit(); " r# l1 U8 `% x" B
}
% m' ~9 E. f2 W i4 d} 7 M, Z( Z" ]! P1 x! U2 {' C8 u
! ?8 {3 P( C1 w( P X
simple.StartSimulation(".Models.Frame.EventController");
' O t6 K8 n7 y+ t2 C6 R8 [ k 5 [3 @* h5 p) z* t2 ~7 o+ G
if (simple.IsSimulationRunning())
7 f: [- ?* L8 ^1 S* u WScript.Echo("Simulation is running!");
# ]0 i- ~) n0 ~. ^) l
3 G4 e; p: s& r0 M3 G3 M. B// Wait until simulation is finished
! W* p. k1 T# uwhile (!Finished) WScript.Sleep(2000);
' o& w2 ?& K. M0 n U' V% t
5 Y; t/ [8 O; J( a- z6 a( c b* V2 ssimple.CloseModel();
6 n) g/ @5 H/ M$ G" r/ ?simple.Quit(); + C+ ?" P2 {! U: S. t, [
WScript.Quit();
5 i% R7 C3 p- _+ {% t+ {
0 F0 t9 ?% [( ^ N0 |9 V
, }" s! B7 {0 S( }function RemoteControl_SimulationFinished()
, E- s* H* a# M- [! [* i. O{
& ^: t2 N0 B) M5 x3 f WScript.Echo("Simulation Finished!"); |