Example of a JScript
5 A3 f* W1 i& G' O* H* i/ Hvar vbOKCancel = 1; 4 s. m9 H" _$ r5 \) |* E: A
var vbCancel = 2;
6 X6 `* `0 ]4 b% Fvar vbInformation = 64; # K* C1 B# P3 c. R$ S2 [
var Finished=false; ! M) n7 G0 u+ H4 E& f* U# L, e& q1 ]
2 C! ~$ \; V1 d3 D3 u, U4 Fvar WSHShell = new ActiveXObject("WScript.Shell");
7 V6 G% M7 r' z9 C! u
4 ?$ T9 G# y) N% `9 s9 ?' ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( A% j2 j' b1 {. d1 j5 }2 i! _ " t2 r6 {% E, H( N% c/ w
simple.SetLicenseType("Runtime"); $ E) b) O$ |8 U! r s0 O
1 E& ^6 P5 C% |' F
try
8 s2 ~4 T+ C& \( X4 r{
. ^4 H6 S& k4 K/ b8 ] // Enter the path to a model file! * e5 D( M. D4 }
simple.LoadModel("C:\\Models\\Test.spp"); 4 H- u/ [$ E2 {$ o
}
4 A) i% F1 \3 Z5 c" [: Ecatch (e) & G$ @- j4 I( q+ l/ [
{
; X4 w% ?+ P7 n* p& H WScript.Echo("Could not load Model!"); 3 ^% ~3 g, j, x6 l, C
WScript.Quit();
" B# K8 _) D# q} ! Q7 N' f( c) i% u" X8 I
$ G! M3 J: ]1 p7 Y5 a U" ctry 7 M; S. l$ {) H9 @( Y; F$ K0 w0 j
{
?. K0 a9 L8 i' I" X/ p& x simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 S$ P9 Q) D. x/ ]$ \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " O: i) g% c5 g' A4 K
if (r == vbCancel) 7 T0 \4 r9 i& X8 R
{
5 i ]5 ]& T& @/ d0 f simple.CloseModel();
6 o4 w1 s# W# k/ p8 X" W% P WScript.Quit();
: [) T7 j8 p+ o1 O9 ?- s2 L }
) u# y) u% x: { o! y) ]- j' L2 m2 D0 S}
& o2 P0 V, a, I l" n" ]$ E$ m + }# S/ s* u6 V
simple.StartSimulation(".Models.Frame.EventController");
3 T6 Q( c8 G: ^6 W- U8 x: U% e* Z" I; e . q {9 ^, R, u
if (simple.IsSimulationRunning()) 5 h) q% y1 w- |! H2 Y
WScript.Echo("Simulation is running!");
6 p/ [9 ]# x* y4 _: j# i x3 R# @ e; u( Q4 ]; v7 k W
// Wait until simulation is finished
+ b# r: J5 O3 {# |; iwhile (!Finished) WScript.Sleep(2000); $ b" I3 J% ?! ]/ t9 K
7 G6 n- D. Q" [' R( d- B) D7 Zsimple.CloseModel(); - L/ w( Z8 g* M, k4 v4 p& @
simple.Quit(); & e& f v- H- e" S4 n6 O
WScript.Quit();
: V o' m* a; S# w5 j; I0 v5 F: g: k & ?4 i* z/ a$ R' p7 X
: i t3 L0 `. p9 i3 @: R1 V9 D8 ^
function RemoteControl_SimulationFinished()
. S8 c( s N$ E- I0 D$ `7 V% u4 M{
6 a0 ]% z, Y$ r8 B' {* |4 U' E WScript.Echo("Simulation Finished!"); |