Example of a JScript ) z6 T5 I# b1 C( P
var vbOKCancel = 1;
a# G5 s2 U; h- kvar vbCancel = 2; 8 U5 J+ F8 n: }; }5 p& ^2 Y/ Z
var vbInformation = 64; . u( g9 X2 v" @; e* Z2 K
var Finished=false;
0 g4 S% u7 p9 @& A S7 \ 8 m: a! Y$ Y$ i& f6 v2 g# x( d
var WSHShell = new ActiveXObject("WScript.Shell"); $ D8 I. I" I( S, d) t6 B
% @2 x. T/ d+ K- t8 n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
{! l D$ k! Z7 k0 f% _+ C
, w, C7 C0 N" T( | bsimple.SetLicenseType("Runtime");
: ]; ]) S8 J) i& ^ , f1 v# I6 O" \; a) [
try , ]; l. n1 I3 z. ~% g% x! L9 I- b
{ ! [/ {; B: H3 Q$ q% e# S
// Enter the path to a model file! & p$ T% m1 e: E- R" l" Q
simple.LoadModel("C:\\Models\\Test.spp");
7 `; R- g) c9 H; i$ W! n2 f4 |} ( T0 F0 g' J+ y, U) t, s
catch (e) 4 [9 @, c& ?* l( {/ y7 k2 C. [
{
8 A l' P( m# M, G' y- R7 C0 n WScript.Echo("Could not load Model!"); % R( B, K N* i6 S
WScript.Quit();
) R" w7 l& _' e3 p) d" Q2 Y1 O}
6 R* ]6 I6 K+ u" m' b ; E( ]/ @4 v) N: N
try
9 J5 M: L$ I; P{
1 f* o# X( j, w9 Z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - z& L- ]9 r3 y7 t
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 z6 p U* d9 i1 G# l9 M& N& i if (r == vbCancel)
7 E' }7 F7 D4 u2 S { ' d' o+ c ?& U5 x" G
simple.CloseModel(); 2 l- l. m' E% j" V$ V
WScript.Quit();
( y, N. c. P+ Z: R2 ~ }
~) R: j1 H: k. i0 V; `} + W K1 a; P! T X7 U. {9 [& k
# A2 S9 E1 |- t' Y" h$ Qsimple.StartSimulation(".Models.Frame.EventController");
( U$ s: n1 ^4 {" Q$ U 4 Y C/ a- ?+ F. y' V0 v
if (simple.IsSimulationRunning()) - \3 C5 z9 @: [! p- J
WScript.Echo("Simulation is running!");
. I6 g# x4 P k6 a
, { h) o; c0 P3 s$ D// Wait until simulation is finished
, C" D4 Y% {# H/ wwhile (!Finished) WScript.Sleep(2000);
1 p* [2 T0 c% ^! N& D& Q" S
$ k. D) f) f3 esimple.CloseModel(); ( Z4 V* ? V+ n& s. z, u" [ N
simple.Quit(); . d9 v& i( g- {" A) s
WScript.Quit();
# w, ^6 I6 K5 b( G7 D $ a1 x+ y/ Y9 ~) ^" I( w+ f
; o+ {! w: \, m- g
function RemoteControl_SimulationFinished() . h) L5 Q& h3 G- D L, a5 w
{ " B% Q. g; G0 Y& X
WScript.Echo("Simulation Finished!"); |