Example of a JScript
$ [. w/ t7 }/ R0 K! M8 lvar vbOKCancel = 1; 2 o V" p0 x8 e5 N; A! I
var vbCancel = 2; 4 f+ B; w4 Q0 r) I0 j- ]
var vbInformation = 64;
6 j/ S7 V' e% V2 F! P/ |5 Wvar Finished=false; : Y' |) J" E e1 n/ l* A; R1 t
$ Q, V. O3 X) k* U- y
var WSHShell = new ActiveXObject("WScript.Shell");
; T# Z, A) m& O
% @0 w. y+ p$ pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) w) {2 m% [4 _1 O2 u
: U: \* I: s9 i5 o3 `5 Zsimple.SetLicenseType("Runtime");
- u: h5 i! {) s* t . L; L# w. V/ {0 `6 y
try
$ [9 |+ \2 X9 | x{ b# K; F/ B1 {+ T! c
// Enter the path to a model file! & Q8 V1 Z! S3 |) e% q' ?5 ?
simple.LoadModel("C:\\Models\\Test.spp");
, s n; E7 q" u& R. k7 {4 C. D} ) l: O, Z0 h- @/ a! ^: N& W
catch (e)
( }: s2 q, X5 g. U{ % p- f1 R6 x; V# e
WScript.Echo("Could not load Model!"); / a# f5 T$ L% P2 f/ d
WScript.Quit(); 6 }$ S$ {1 p/ ]$ T0 l& b1 K
}
, `6 Q/ k# n* n8 T5 |3 d
$ R& T2 Z* B+ A$ o" P& G. T( u, Stry 2 t# K" p. ?1 |/ z' J) n
{ 0 H2 }' k+ T+ H. A. I$ K1 j- B0 n8 Q
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 k z1 _$ i e9 ^4 i& b8 Y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) E( t6 K- e8 e! L( l, n+ | if (r == vbCancel) ' \4 O/ y5 c! R0 ]5 ^2 K
{ # i$ k1 I6 ?* x, A
simple.CloseModel();
: f: f' s6 x! L WScript.Quit();
+ P/ U% x& J2 i" c) s) V }
, z* n) ?. C4 P}
7 q+ `9 B4 D7 y$ ` 5 ]- Y" O* b; E* N
simple.StartSimulation(".Models.Frame.EventController"); / ]# r7 A. }, h: C
. K, c$ l& ^2 I% j1 |/ L/ vif (simple.IsSimulationRunning()) , R, |8 D: X: y8 d8 \
WScript.Echo("Simulation is running!"); : r/ S/ M/ @% Y" k6 \
. r1 a5 j' f6 R/ T* R( n7 e
// Wait until simulation is finished
( [0 _6 s* {* t; S+ Ewhile (!Finished) WScript.Sleep(2000); " j/ t; U, z. i+ P
2 X" W4 S& M' a% ^) ~simple.CloseModel(); A3 h+ t. W9 }. w
simple.Quit(); , h0 | j' J3 U- H/ P
WScript.Quit();
( r9 x, s. [6 A' q1 [: n
# j2 q% p+ Q# k/ l
3 y- z) Y# B' `% V" Dfunction RemoteControl_SimulationFinished() 2 V' I. _# l1 n& X
{ + ?7 e! M; [3 P- _7 P) O2 {0 B
WScript.Echo("Simulation Finished!"); |