Example of a JScript
* f/ G' _% |. l: v: Gvar vbOKCancel = 1; 3 u% e; d, S* Q# w4 {
var vbCancel = 2;
+ u) s- E9 t# Z4 Y9 cvar vbInformation = 64; # e+ m! ^ K1 f* m
var Finished=false;
E1 A; Q! U3 \ 6 _1 c& T0 X( p# b: S
var WSHShell = new ActiveXObject("WScript.Shell"); ) C8 ~5 `- @: w) N& ?$ M& p" H
. P/ w' Z' c, t+ ]4 v# e( Wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 8 Y0 h& C0 b# O
6 m$ X2 c5 k6 m- n: o Bsimple.SetLicenseType("Runtime");
1 Z- b) f/ g# D- K' |5 f2 t4 r
! T" R m- A8 e' }' Ftry
; c3 G. Y2 z: w{
& R$ k) A6 T( D5 o' b // Enter the path to a model file!
7 Y8 m4 `+ Z7 U4 d simple.LoadModel("C:\\Models\\Test.spp");
0 S' E+ y; U5 B2 Z} : t! k! O% P. M9 U9 B& }7 g; v% z
catch (e) 1 G& O) I) h$ K
{
8 p4 M7 {/ `. t) x% s2 ?8 s WScript.Echo("Could not load Model!"); $ B5 f6 }5 d Z0 X
WScript.Quit();
2 d \# G" ~2 `% J; Q6 V}
: _$ ]* t4 `( Z& G# ]5 Q! @ O 1 q0 y5 t& r$ a4 H/ U, n
try - Q' M$ }$ V$ Z: c& G8 ]
{ ; n R u0 F+ y Q% G0 q( u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
X1 N* @ u9 n: ^9 e r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 x2 i' J4 |9 Z( q0 c- d if (r == vbCancel)
& G! T: S) h: ]* G5 g- a { 2 m( Z4 \1 y3 e! G
simple.CloseModel();
8 W1 l G' G: O WScript.Quit(); # @( w* i% E5 |$ P$ }
}
# ~, f8 D. `( W' H2 f0 y2 d' | ]} * E' }* w6 V; Y: O( ?
, E y8 f) P1 B. L1 Y' _simple.StartSimulation(".Models.Frame.EventController"); 0 e8 J4 T4 {" Q* n/ ~6 P/ t
* i& ~3 C; z( n# ^2 K7 z4 rif (simple.IsSimulationRunning()) ' u. X4 X3 z2 C+ p. y8 s
WScript.Echo("Simulation is running!"); * O8 r% l2 { {7 g# i$ K
1 R. {) k' @+ a c8 u0 H/ m// Wait until simulation is finished ( O6 M: |# h$ r: W* `3 E* u( |
while (!Finished) WScript.Sleep(2000);
0 \' K# H3 V' K. K5 i* \ 5 r2 i* G9 k! N1 d7 b
simple.CloseModel();
7 I0 l7 B# q8 Q7 ksimple.Quit();
! V; U9 [. e, M9 r; R. rWScript.Quit(); + D V: e! j9 F6 _
: z# ^, p1 \1 A$ V/ o0 y1 b
& M9 K8 g: S3 N! T% @, i8 A7 pfunction RemoteControl_SimulationFinished() % A; X/ s, C' }( |
{ 1 g( K! o8 [* J4 R% W* {
WScript.Echo("Simulation Finished!"); |