Example of a JScript
+ @' G) C. V# }4 c& Uvar vbOKCancel = 1; . g, [1 o% f0 x1 A3 d! e, v
var vbCancel = 2;
+ N- G$ z" ?- t; C: Y9 J% Xvar vbInformation = 64;
+ j8 L+ f1 E5 z+ }1 X/ Bvar Finished=false;
+ I1 }8 `1 P# G; e9 |5 s- h B6 p+ \" v, ]& t: l6 D. }
var WSHShell = new ActiveXObject("WScript.Shell");
& n. a4 ?/ ~0 M9 q1 Q/ L ; _$ ]+ G6 j4 w% X6 U5 ^+ G& p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& O, t* o! n3 H9 i) z$ x% m' m
' x5 c) @* I$ ssimple.SetLicenseType("Runtime");
4 R% {# k; ^+ `7 a- V
0 ~: m' w: t4 R! p/ z9 u+ X% Dtry % e% r% l3 f" z$ Q9 ~8 M, x, w
{ 1 G/ P0 Y- G3 E5 R9 M: d
// Enter the path to a model file!
& J6 E: v. m5 e6 K5 J9 m simple.LoadModel("C:\\Models\\Test.spp"); 4 X. D/ i$ x3 M3 c( d2 X
} 7 R' U/ F: J5 y( i, i; k& Z
catch (e)
7 y0 K1 I5 Z" g s{ * A' a3 T6 P8 K, C& J" r
WScript.Echo("Could not load Model!"); # D5 [, Y; G% y
WScript.Quit(); 2 O/ t+ d- I: a8 O0 d; z* F) C& V
}
: x+ `) @4 K6 q " f) Z7 C1 z: W8 m2 C* {! V+ C" ~1 h
try ; S* R7 o$ s/ j3 i" L: a- h
{
& V; a* f7 T4 U6 j! c simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " u2 V2 `0 f& M' Y: e4 r1 q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! D- C; U# A4 H/ J if (r == vbCancel)
# O6 M) \& E- s9 c: r, P9 l7 { {
: O3 K" [, {/ H. b simple.CloseModel(); 0 B# a2 n, ^; ` K% c
WScript.Quit();
( k$ W3 a* [8 @7 Y0 L' K }
; D: c' e5 Y1 W1 X}
( I C. f1 a( `. Y( P- H7 k
& N7 g b2 A3 [" B, Q+ T' V9 _3 Csimple.StartSimulation(".Models.Frame.EventController");
+ S% y, i% Q. z* t k 1 i$ l2 u, v+ @ d; L# y
if (simple.IsSimulationRunning()) 6 `7 n# A8 y* ?- S4 T; u
WScript.Echo("Simulation is running!"); : {. P1 i; T1 E9 r
9 v" p* H7 y* ~9 r
// Wait until simulation is finished
, _5 T4 E1 r: b$ q9 m4 jwhile (!Finished) WScript.Sleep(2000);
: D* p6 F0 e3 Y5 {+ h8 K
) O9 Y9 ^) L+ D: M* v& p5 h$ usimple.CloseModel(); " j ^5 g8 ^' ?9 T
simple.Quit(); 9 R. q) U5 Y7 i' ^/ u
WScript.Quit();
" K3 z* J! l- y5 K : F2 {8 a3 ~' ? |: ~; `
. Z! Q: r& Z" M4 L( jfunction RemoteControl_SimulationFinished()
1 V/ y+ n$ Q( [; j) c{
: P# C& m) z5 Q1 y' p) f WScript.Echo("Simulation Finished!"); |