Example of a JScript
' F+ Y4 M3 y' d6 u0 P- n2 x& g. t6 Tvar vbOKCancel = 1; . w z( \5 P. o8 |6 X) d
var vbCancel = 2; $ P2 [4 U! w! U. K" ?
var vbInformation = 64;
% j& ~9 z3 y V- V6 J/ K0 Xvar Finished=false;
! _& U7 g" x9 I0 s. N w3 A
" q8 t0 a! G9 Gvar WSHShell = new ActiveXObject("WScript.Shell"); 0 K/ |$ m- X2 n& \
3 f3 ~) k; F! t1 Q# M
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; i4 r" J3 C% Z8 b* d9 [
' Q& U8 ]8 ?& `, L7 asimple.SetLicenseType("Runtime");
! }9 I2 Z& b( d' k( z3 c N3 J; O) @* t, F% I
try 5 T, `. O* }* O/ q; U4 p) t8 J
{
6 b0 s' [2 c7 P$ `$ |" o // Enter the path to a model file! / O6 D4 X! o" n6 ?8 O, ]
simple.LoadModel("C:\\Models\\Test.spp"); 3 D8 F" f- \! O2 [6 w
}
% G5 l3 M9 r4 \& Zcatch (e) . `0 ^1 Q ^6 W4 U
{
+ Q6 H+ _1 L0 Q, g6 C WScript.Echo("Could not load Model!");
1 R& K9 r4 x* ^& ~* g6 B4 ?6 h WScript.Quit();
% t2 C1 z6 i# Z# B6 C}
1 t5 n$ [* n% F% A9 }+ _* | : l; v+ ]" m! C1 l
try - F$ u5 ?" q: C: V6 ^# M/ ]
{ 5 S2 Z3 n N* ^+ ]- K
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 b0 d( I' F- ^) Z$ k/ k5 v r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, P1 i- W: L G" Y* n( M, a+ ~ if (r == vbCancel) * @; Y7 V9 ]1 `* d7 q3 u F
{ 2 R! _) [2 _8 i3 {0 w3 I3 \
simple.CloseModel();
0 Z4 h( N* o% N) B; g& r WScript.Quit();
3 u) ]& f: O0 G# Y# G* c }
) l! W4 {1 Y, M+ J5 \}
' p( Y- V$ b. W! a1 M
. W: n' m# a& g( C, ]- `simple.StartSimulation(".Models.Frame.EventController");
$ q& I' d# ]/ A. I' \
( J6 C# L8 [5 L3 H Q rif (simple.IsSimulationRunning()) 7 y5 X$ m1 b Q. g+ w" L/ S' x, e
WScript.Echo("Simulation is running!"); 6 b0 I- j! F( \( f4 z
. {5 e( f$ a% g
// Wait until simulation is finished ! X$ J' w. L1 N: t/ T
while (!Finished) WScript.Sleep(2000); 8 b4 l$ e3 H m. o7 a/ x
% i# U% Z$ Y) i3 ?! ?0 \/ ~& N
simple.CloseModel();
U5 q3 I* F* ^4 v9 N* x) e" K- ysimple.Quit(); 4 }: C- B1 ^$ f% H6 m$ B- f
WScript.Quit();
, J; x. f3 }0 w- c 0 ?( Q( O/ k1 h/ q# Z( \: x
( J/ O( ^# a& o( k( _) `9 m$ g' U: Zfunction RemoteControl_SimulationFinished()
# S+ V5 v& t) p2 e3 a/ O% z{
- {# w' ]7 J8 |# M! z: h2 |$ Z WScript.Echo("Simulation Finished!"); |