Example of a JScript
7 e: e. G: e! |* T# W# Qvar vbOKCancel = 1; 1 A7 Z4 q! A. W9 i
var vbCancel = 2;
% B( A g3 ~: y6 X9 S. {* Q W' fvar vbInformation = 64; 8 @8 `/ [* W% h1 f3 u. T
var Finished=false;
9 k! X- V, p6 \ Y$ h
9 M+ \4 H, m$ Q3 f# nvar WSHShell = new ActiveXObject("WScript.Shell");
1 i. q5 Q/ V1 a4 X; r6 T
3 w. C! u' |# h% c" ]var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 v( _! ?, p, T$ \- ?+ T + w; _9 W2 H. Y z: I$ [$ d
simple.SetLicenseType("Runtime");
) {9 `1 w1 w. c+ p) b ! q/ a! T8 n* q0 j/ `1 N
try
: }% M+ j* h7 a{ ; u2 Y) E& ~1 K+ f
// Enter the path to a model file! Y8 b3 O3 o! V& I* N5 v" w" w5 h
simple.LoadModel("C:\\Models\\Test.spp");
) f( G" P% v) c' _% z}
; ~9 i4 a) H' Bcatch (e) : {9 i* N% x5 x# n
{ # a0 d, I# s, A. }$ r9 H+ l" ?
WScript.Echo("Could not load Model!");
( p w1 h" n' l B; o D5 } N: f WScript.Quit(); 8 y3 N# G; v+ J' R
}
: A" v, N. ~/ b1 P. m
# p2 i3 e) i' R8 t' V; Etry ' A1 j; K( F+ V9 H
{
: n2 T7 T' y' z7 M3 C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
/ Q' u2 y8 p1 \0 W$ W) ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 D9 L' C4 b% y& @
if (r == vbCancel)
( ~2 b7 ~5 ^) {* }6 _7 h, C: X1 I: u { ! j: Z, a/ \$ V" ~
simple.CloseModel(); 8 L5 O7 B/ X# X x- l2 T7 q2 p( ]" t
WScript.Quit();
! ^, S4 n* f& d6 W, r2 i } # g# [0 X' R6 N' `, v4 V
}
) w( @8 c( |4 U# e
( N w5 g: g8 r+ esimple.StartSimulation(".Models.Frame.EventController");
9 `1 \% h0 K* [# ]8 ~ ; r4 I. }2 R' F, ?0 Q4 ^" \
if (simple.IsSimulationRunning())
0 ^% G1 }' r V# C7 r3 @$ c WScript.Echo("Simulation is running!");
& y6 v4 ^) Z6 `5 j) R: E; K, b 6 e* I6 x2 T6 y3 P& I
// Wait until simulation is finished
; y" m. `4 |8 q" D: uwhile (!Finished) WScript.Sleep(2000);
1 h: D7 o" @( ^' G+ j
. z, K# Z. M' Y) Z; s: jsimple.CloseModel(); - ]; S @8 |6 w O, R3 n' y/ B' d/ [' W
simple.Quit(); 8 S0 z5 g6 V# o/ J" E# V# G4 E0 @
WScript.Quit();
9 M$ \9 B- s, t; p3 v
# |+ H y# Q6 ^) u4 D. D + y' k& Q+ }7 {9 b+ }) i, G
function RemoteControl_SimulationFinished()
$ }. B2 K" a3 M2 {{ . r( P M X: d, B- e6 @5 f
WScript.Echo("Simulation Finished!"); |