Example of a JScript
4 I; F% `" r7 @ R: Pvar vbOKCancel = 1;
- y' k* x& n$ {7 s+ ^0 wvar vbCancel = 2; 2 f. T, M; V2 @* a- G0 T7 R8 U$ B
var vbInformation = 64;
& d! s- y$ e M5 _( \1 Tvar Finished=false;
5 ?3 S' U0 o# D! V / }+ i$ O# J4 T: ^4 [; p
var WSHShell = new ActiveXObject("WScript.Shell");
9 _7 T8 Y$ `/ U* X1 ?
& m, O o: H2 |# g: s9 _1 t+ o5 x! Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& V5 S4 y) @6 U- E+ D, j% z0 n( I
5 z4 O% q& s7 [1 k) Lsimple.SetLicenseType("Runtime"); ) k+ w3 B* t3 N) l4 X @5 N; n; n
9 C# u- s; F' f1 V4 `* E: Wtry
! q0 Z) Q! J, u7 ]0 q5 ?- N{ & ]. S" q, \$ ^( U/ C
// Enter the path to a model file!
) \8 w5 N* K; y, h* |. \' s simple.LoadModel("C:\\Models\\Test.spp");
B0 \3 K1 v7 [2 K} / J6 b$ d$ g5 r2 n7 h
catch (e) & R5 Z* {, \# c
{ % `& |, {5 t) G" Y* k' Y
WScript.Echo("Could not load Model!");
1 H& p; O) t, Q6 p* O! ] WScript.Quit();
7 n( R: q4 [& @$ a2 s) \}
g& a1 [9 B4 z! F7 _3 L9 a, [ 3 E8 U* k3 Z, n1 L: I
try
% y; y H4 }4 A2 k( T7 m8 ^- G{ # o6 s: r o6 c9 k3 m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 e! ?( A# m3 ?: q
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
8 _; e+ @2 |2 t( l' o if (r == vbCancel)
i% k+ N7 x' U9 |, Q6 l" @( z( I) ~ {
5 v: U' V, |. }5 I simple.CloseModel();
0 K- A0 H2 w3 X7 V7 b8 G! p) H WScript.Quit(); % r9 `, }' l, b9 ]9 }# n
} T4 Y% P& G9 c* @6 c/ h
}
3 _* l. h' t$ f! S1 u# Y6 ]6 L
8 ^% D& ?+ v$ Usimple.StartSimulation(".Models.Frame.EventController");
# U! [+ [6 B/ M8 a% d ! s# k# [6 Z; w/ H
if (simple.IsSimulationRunning())
3 Y1 o. ^" C" w/ o WScript.Echo("Simulation is running!"); ! i/ u* |8 f) \) V6 T" @( G# H
: K+ Q+ W* _2 U1 y// Wait until simulation is finished
2 G: w' V/ r, C" b- V5 ]% I; Ewhile (!Finished) WScript.Sleep(2000);
: d2 _. }% ]& B5 P) M. Q - }. |! J. M ^7 q6 C+ e# W% N/ R) g
simple.CloseModel(); ; v$ m1 I i# {6 [$ Q4 y
simple.Quit();
' G* m% J9 t7 U aWScript.Quit(); # O3 N# S; L8 t' p' S0 P3 a
' O9 S b, ?# ~2 |( F7 v
0 h1 m# c- `) M; @function RemoteControl_SimulationFinished()
9 c' a6 Z8 s0 i% F{ ' _+ c+ B2 Z: W
WScript.Echo("Simulation Finished!"); |