Example of a JScript ! r9 l2 J, G. r5 ~; x& A
var vbOKCancel = 1;
) `+ U0 U2 B3 I* C7 Uvar vbCancel = 2;
! e, b; V3 v- g S Y tvar vbInformation = 64; " ~7 M' ?) w/ \3 N+ l6 U/ O
var Finished=false;
( i" S) g# h- T! i* k ' a+ j( r) e! v- R
var WSHShell = new ActiveXObject("WScript.Shell");
; \5 f, i1 s" |$ c: x! \ q
h7 Q a3 @9 x/ Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
" U$ b* Z9 k; o( _8 P 5 c% G. s0 L, n4 @' x
simple.SetLicenseType("Runtime");
: q; s' b& S' Z7 O: y- Y5 _7 F2 o1 j
$ C# D( ~/ v n- rtry + T1 M0 s. ]" W. [: U* K( z, X
{ 3 m+ O, Y# C/ s3 D
// Enter the path to a model file!
4 Y# X/ ~9 ] s6 }8 o4 H simple.LoadModel("C:\\Models\\Test.spp");
" m# ~$ |- r+ r2 ]% X}
0 _% G& q/ _' Q' tcatch (e)
: \ o" d G6 H8 _{ 3 r8 `0 U8 X% w' C# K4 j
WScript.Echo("Could not load Model!");
( W1 ^0 u/ S" E9 P# z; q: y1 { WScript.Quit();
5 k1 `8 G8 t8 s4 z- Z8 Q}
e3 s) z1 b4 R' \: g) T, K
/ ?. e7 M0 n8 C% r& \9 Q% ftry
- j+ K" l' ~- B{ / `1 D& t0 V# w( j$ @; q) S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, ?0 o$ V% u# i$ S8 ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 e0 b Y4 G9 v if (r == vbCancel) 4 H2 k0 E0 q1 a5 ^
{
/ U, I/ }' H* V' c, c w+ u$ h2 x simple.CloseModel(); : |5 A3 P* l- Z* Y* W/ V" }
WScript.Quit();
4 `: q; ]; Z# D# L; O7 U0 I# y } # F- v4 _: j* B( A, v- F
}
; u8 l" k1 W% d% k$ o
( x( O6 ~! j' q9 b! C5 h- c& Nsimple.StartSimulation(".Models.Frame.EventController"); $ T c& v0 J8 E9 ], h6 p+ c
}. V2 l1 @! C. b
if (simple.IsSimulationRunning()) ! v* S) h8 c6 k) b8 D+ F
WScript.Echo("Simulation is running!"); 0 A+ o7 {- D9 e) d
1 B) _& N5 W% Y7 Z
// Wait until simulation is finished % T2 J+ i$ k- z# H
while (!Finished) WScript.Sleep(2000);
* s; y- ]' _; \& ]1 w5 |3 d* O
' l$ `3 _3 }% m4 X2 D. Hsimple.CloseModel(); + ?% j' V! s5 H0 i {; O/ B
simple.Quit();
* D1 |& }' @8 r4 t5 |! ^7 [WScript.Quit();
7 r, d; E) f7 I4 F8 h. b5 Y9 U! `
9 t9 `2 v* h( w& q+ Q! M" B! ~; G l( F( W4 f7 }" Q, e
function RemoteControl_SimulationFinished() 1 Q3 p+ y% a4 b' ^
{
~: q% C, \$ W# o ^ WScript.Echo("Simulation Finished!"); |