Example of a JScript
9 L* M3 U/ z% a I0 ivar vbOKCancel = 1;
7 y% l: f/ U/ _; Pvar vbCancel = 2; 8 O$ z& |& J9 v( t* k8 c
var vbInformation = 64;
1 {5 U/ o7 D3 U; v$ }8 ]- o) Lvar Finished=false;
: U4 n! R- ]" y# k
2 Z6 P5 R! Q5 C; @2 m7 ], mvar WSHShell = new ActiveXObject("WScript.Shell");
# K1 ~) l3 x$ v$ d: t5 V, S ; y, b* [% H4 A: D! s
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 y# A! _) \& D4 e+ n1 a: Y6 o! C* T
1 o1 V( n- J) w" {* ^6 u3 n: u( r' ?
simple.SetLicenseType("Runtime"); ! H) y6 V3 ?/ z# H
$ p! Q0 v. o( I# m) v$ ?try
' d3 q6 d5 U* J# m! J" f: R" k{
& b6 b' o1 ~& [8 Q/ l5 i. ^$ L // Enter the path to a model file! & b7 a: W7 x# g* E9 d, Z x6 |
simple.LoadModel("C:\\Models\\Test.spp"); 8 p! L1 T7 {0 ?; X% e; S# ^5 s
}
- P- Y+ t9 J9 }; c& w6 Hcatch (e)
# p1 F) ?2 }) @, ], Z! D8 }( [5 K% u% M9 H{
0 q6 M; ~3 t/ g9 h6 n- p; U WScript.Echo("Could not load Model!"); 4 Q- l3 W" i, I" [5 @
WScript.Quit();
* R1 e1 J2 {/ Y" p. P: u4 m) Z1 L} , ?- f' O& N( \$ B0 H3 T7 {
+ a% O1 z5 D8 ^, z: P, ^) l) n
try
7 t1 z* [. }, f; W) y( B/ }{ 1 a# f8 R8 E' D/ f% m" i9 j% c' g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; {& a% c y# u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 l2 W* G! ?$ Z6 d. P if (r == vbCancel) : }9 k* A* ^4 a+ i% X1 C. p1 K
{
- g- ~; H; O% G2 m4 b8 w. g simple.CloseModel(); ; E1 j# T8 n! F- @$ ?
WScript.Quit(); 4 |4 i7 v& d: @3 E
}
. k% q; ?" W7 G7 l2 J+ @} , m0 h6 O0 `/ X
1 V! A o. e6 ]. S2 c. _7 t6 K
simple.StartSimulation(".Models.Frame.EventController"); 9 S' ]$ T1 b3 M4 i1 ~. s2 g
* y5 Z* |& t1 X0 p. ~+ \' o1 i. D9 Wif (simple.IsSimulationRunning())
- l* f o8 L$ n: y$ J# o$ V+ E# I WScript.Echo("Simulation is running!"); 7 b5 i6 }, b- \) t! r
( t7 g9 c. C6 U9 C G* x" ?
// Wait until simulation is finished
. j% L% @# @8 _8 s" ywhile (!Finished) WScript.Sleep(2000); 2 N- v) ]8 Y* o0 Y& ?& o
$ U3 ~1 B( l( x+ L5 {! fsimple.CloseModel(); - f& ^- T L- O1 d" b$ h$ I
simple.Quit();
$ d) |! W! u6 Y* wWScript.Quit(); : i: H2 z% P9 |; c
$ {) s: g6 u3 N% m" X
: ^; f) T! C: v. o, t; B* Dfunction RemoteControl_SimulationFinished() , s) }2 N& t! s, v6 m
{ 3 x) c& w* l, e1 P+ R3 D& M5 Z# C
WScript.Echo("Simulation Finished!"); |