Example of a JScript
2 P+ A% X: C( m5 q' pvar vbOKCancel = 1; + r M: B; D8 O' x. i: g/ Y7 A a. e
var vbCancel = 2; % h0 o. M" L9 x* e
var vbInformation = 64;
; {! J7 g! z. _1 f7 p0 P7 [var Finished=false;
0 V/ H3 m! t" R$ l" V, T" a
3 m% @) A. @: k0 y& ~var WSHShell = new ActiveXObject("WScript.Shell"); 7 w/ P: p# b4 u8 @
. H4 b* Q6 }! C: ]) w. Z0 jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# U; M; X0 _% n( k
: D0 l/ W7 z8 nsimple.SetLicenseType("Runtime");
/ m' E5 n. q1 d3 b: y2 `
# P$ `' Y" e3 m) v' wtry " a# {& n; m5 n4 ]0 J
{ % X/ P2 K* z- M+ F
// Enter the path to a model file!
3 X: d/ o; V+ _6 p' k; w! M simple.LoadModel("C:\\Models\\Test.spp");
. E% ^1 M2 p( I2 f) ~, n/ t} ' `" N% Q- P4 x; V
catch (e) / f1 j; j0 h ?8 u# v
{ + U" Q, c }) N4 w* o. C
WScript.Echo("Could not load Model!");
3 I* N$ ~: b) y( k WScript.Quit(); 3 f" \0 ]6 G; a+ ^5 F* r K3 F0 y6 S, R0 `
}
; n. u. D7 r1 v4 G' S( A% U
|4 l# c& T4 l5 f5 @; N) v; atry ! x) @+ Q" ?6 U) g' g$ Q
{ 0 ?0 w* }, Z2 `6 ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) V x6 B J. s. e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 v6 Q0 w2 T0 [+ A9 C- E+ R7 i if (r == vbCancel)
" D: F5 H5 d) y f$ D3 S5 e {
* u) ^5 V& J$ D7 _ W2 f* T6 e simple.CloseModel(); 4 }3 @3 w4 E& K; G! Z8 ^5 Z5 u7 c9 O
WScript.Quit();
1 _3 g2 W2 |6 A+ d& a, g }
" v3 A' J @" P3 q- c4 L} " k! u" Q6 l4 W3 Y. Y
* D/ p# m3 z" U8 E. {2 V& V& L
simple.StartSimulation(".Models.Frame.EventController");
3 Y0 C- G# f. Q: \ ' u9 \9 |6 E5 j8 o) Q& H) f0 J# U
if (simple.IsSimulationRunning())
N A4 r/ w2 t WScript.Echo("Simulation is running!");
& G+ K: n8 s0 |( F! h
' |/ O9 `* h. r8 F h// Wait until simulation is finished 8 A$ Z9 ~; n: |' t
while (!Finished) WScript.Sleep(2000);
$ ^ m- E+ [# ?1 r" K; ?8 T/ m3 T7 w ! m. j* {) s. R, s1 R& d9 ?. D3 w$ w
simple.CloseModel();
3 u; t! D! U/ V) r; Tsimple.Quit();
8 @7 c; z+ F9 u: C$ W7 m8 uWScript.Quit(); 3 H$ j0 ~; {, E" q5 S2 B3 M
' y% W9 I( \9 A) f( g
1 A$ s1 L9 ] l" Afunction RemoteControl_SimulationFinished()
' ^* P: K' z8 y( D{ ! A w9 v- b# ]1 m
WScript.Echo("Simulation Finished!"); |