Example of a JScript % g) `. s9 f* t2 Z# Y3 h! z
var vbOKCancel = 1;
5 r, t, S. b8 A; `/ K$ D2 ]var vbCancel = 2;
3 E* `- ]5 A( v9 W( Y3 W& ovar vbInformation = 64;
V/ X( G1 e4 T; g N% o& o5 {: wvar Finished=false;
' n& y6 F, ]# i6 U( `3 ?
$ d0 k1 n6 m) c9 }: M2 Z+ F+ g2 b# Lvar WSHShell = new ActiveXObject("WScript.Shell"); ( P$ T. F' W, U8 M6 A1 Q* D4 I
3 s$ E9 D+ }, s- G0 B! `* {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
) }6 D" k1 I7 x3 G, s + x. i; G: I4 @1 l
simple.SetLicenseType("Runtime"); ' ?4 W8 ]: n. D6 F, `
2 k# L3 t! \ v: V* u
try : }! D. e6 }' K5 W# [3 I0 L
{
9 C; q1 e0 f& Y. T: }/ T0 @6 `% m // Enter the path to a model file! # W; q. g% U3 I3 ?) q
simple.LoadModel("C:\\Models\\Test.spp");
7 m d* h E/ ]! @' @} ' v" s' q# l ]/ n; e) z
catch (e)
* s7 [4 ?- `3 Z{ 4 n8 S- {* Y# H. x
WScript.Echo("Could not load Model!"); 1 ]! Q5 }4 x: \
WScript.Quit(); 6 I1 J+ `( a/ K: ?4 L, Q
} ' W/ n c" @& P2 h% C
- h5 L) g1 U( h& {1 Otry
2 O, z! k H( N- _% {{
6 [" u4 v# F) A; M simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 \$ q: O7 _; [* s+ b& h1 k& b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / U& b) w+ Q: K# Z4 s/ I q
if (r == vbCancel) , ^) a# a: {" N5 f
{ 2 A, Y, Y$ g, h3 d: Z6 A, X
simple.CloseModel(); ' o1 r( V5 m4 g# F
WScript.Quit(); 4 r* W w: H2 `$ ^
}
% ]5 G& ~) s6 i9 t, y& P% X! X} ) U, T! [# L5 q8 f9 N& x
2 F, ~6 M _* b4 i9 I {; `simple.StartSimulation(".Models.Frame.EventController");
* x2 k; }0 g, t2 u3 m; \
% r7 a. V Z6 u0 j) L/ w, ]if (simple.IsSimulationRunning()) 8 n& g4 o" M3 { `0 \& g
WScript.Echo("Simulation is running!"); 8 E ?8 p$ E" ^3 A2 I& Z/ Z! T
* Z' T: \9 U2 H v% w/ L// Wait until simulation is finished
7 _% L/ A# q* b0 E) A6 Owhile (!Finished) WScript.Sleep(2000);
8 g5 B3 U& @" Q: U! s/ p1 E % t5 t. n2 {8 i! g* y! e
simple.CloseModel();
2 |6 L9 K# ?% H* [9 A' O; ~- Vsimple.Quit(); * M! y) B4 h/ ^) h, H* k
WScript.Quit(); 3 ?8 f: W3 X9 Z9 y8 o; U" h- \
6 ^$ O0 O( S/ H& b+ d }
. r+ m& l5 P! t$ \6 ]: ]
function RemoteControl_SimulationFinished() # ~# Y! [% X$ L# |/ z7 r, q4 ^
{ 2 z6 U. J* F' D
WScript.Echo("Simulation Finished!"); |