Example of a JScript
6 E6 t. k9 a0 \. W! P9 kvar vbOKCancel = 1;
_/ [& ~. n' e4 Tvar vbCancel = 2;
h$ F j: @9 Y5 ^4 L! a" {+ Q. U. \var vbInformation = 64; + j" d- P& S8 A
var Finished=false;
# F( J; `; c1 I7 A& E+ _" D 1 V; }& i+ D/ ~ s) n0 ~
var WSHShell = new ActiveXObject("WScript.Shell");
1 }, T5 T! [: r2 o+ t0 h , r5 I& P; f: p! q8 h+ L
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ; F. N6 L: c2 ~( ?. l8 ~" e! g8 T
8 H' k( h/ z/ A) D# H% [5 j/ c
simple.SetLicenseType("Runtime");
8 u) ~! h5 Q% M; h( Q
* Y+ u/ W d& t$ ptry
0 R6 a3 X% L! {! g{ 6 y5 [/ V5 N6 x
// Enter the path to a model file! ( [. R- b( W; f+ H! Q$ C; z
simple.LoadModel("C:\\Models\\Test.spp"); ! P T3 L2 F* a7 r# i) a4 X
} 1 Y/ `: U1 E+ m* b2 S/ {
catch (e) . M3 h9 J M) P9 X2 ?
{ 3 h# U% `4 ~9 L! i( j5 M
WScript.Echo("Could not load Model!");
9 t1 U- P8 j1 w) w, E WScript.Quit();
3 k, {& _8 d; X) g" }5 B l}
- t/ m# ]# |- h4 r$ [ 1 D; L, ? _3 c' ^+ G
try ' D2 T9 V2 g- g: l" h6 M/ x
{ @/ X7 y0 a( M. g, m# ?; D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 L1 D! J% t; Y" V; Q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
$ n3 u) ]) f. e- `6 ~ if (r == vbCancel)
' n9 Q. |. v' i- L$ b { 4 T5 s. w% o0 q3 A6 `( S- X, i0 l
simple.CloseModel();
" u* i( v C+ Y u# L( s WScript.Quit();
$ m5 N! R# q; | } 8 i3 D, l: X2 o$ Z
}
/ I, `! M+ N& x3 f/ C S 3 H/ {% R9 T9 s! G
simple.StartSimulation(".Models.Frame.EventController"); 1 w: }# U7 V- j6 o
' m+ Q' j& v' ^7 |. Fif (simple.IsSimulationRunning())
& l/ o ~8 n3 Y& h. t WScript.Echo("Simulation is running!");
* @! ^( t% g h: }% y: l
. {) v7 Y% Q4 X5 W* _// Wait until simulation is finished
% E0 s- Y- R" s+ jwhile (!Finished) WScript.Sleep(2000); 5 y& i/ u& Q6 n+ A' Q, [! c- Q
6 p6 }, @; Y' E v2 |. E. Y7 J) S
simple.CloseModel();
, ]" F x# c. W6 P+ x- f( K+ ysimple.Quit(); 1 }( a. y3 t9 x" |9 [& L H4 z+ ~
WScript.Quit(); 0 D) d3 T: m3 U" k
! T5 V+ N3 i8 r: V# y' C7 z
; V, x7 c# Y; T* `9 _! g+ N }0 vfunction RemoteControl_SimulationFinished() 3 Q1 t' n, l5 m4 c K n
{ , `1 n; O! h3 D5 B# T5 T6 W ~
WScript.Echo("Simulation Finished!"); |