Example of a JScript
7 V( {; n e* zvar vbOKCancel = 1; / m$ I$ a/ O) s
var vbCancel = 2; " i. T4 n* d: y0 R% M B
var vbInformation = 64; 9 ` k- b2 x4 g2 u3 r
var Finished=false; ' l- l/ t3 M* R8 ^( Q$ l6 ~& e' h
- b5 b0 e& n3 l# E
var WSHShell = new ActiveXObject("WScript.Shell"); 4 K, t# Z# Z6 H, O
' ^$ t/ t: Z! c! q: |7 D; H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& `0 t$ M' D% ^3 C1 \, m% }& M 9 g/ J B# j/ d2 T
simple.SetLicenseType("Runtime"); 4 n) }2 }8 s- m1 F( x
2 o$ h- x3 `* v4 E! Etry
9 i- @0 s* ^3 j/ q% o } h8 _{
: D, V0 g2 ^- |. I // Enter the path to a model file!
5 _: x+ F6 z! J5 } simple.LoadModel("C:\\Models\\Test.spp");
5 E. {* H! A; E# y5 Q* N; v}
1 Q" C( h$ q7 a3 P" pcatch (e) 4 W+ M3 c0 S! W, _
{ + V2 V, {7 u9 t3 ~
WScript.Echo("Could not load Model!");
$ |' c- e4 s4 Q; \1 u8 w WScript.Quit();
/ A! G3 A: b, U; r n" n}
6 d$ U" @2 o) S2 M. }
L2 \: U( C1 ^# ]) Y" b3 ntry ) ^7 p; {+ T% z
{ $ y P- {1 F$ h7 m8 G
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 w4 ~8 u* Q! d( j# `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 \4 @6 W, W& X' N
if (r == vbCancel) * c* O) w3 g( [# v: i# @* e$ _
{
5 ^- B9 I2 _" ^6 o1 X simple.CloseModel(); - \9 c+ p% |2 h8 J/ M
WScript.Quit();
" i: Q A, r/ L; O8 S. C8 @ } ( g" m! Q* V# ~" ?% X1 n
}
% P" h% q# o! a( x* ^: L Z) e$ `
& x" ^( C W8 h( q" p8 Y$ Msimple.StartSimulation(".Models.Frame.EventController"); & P- y, `$ L* a
! P: c- H3 O+ | f1 |$ N* j7 W4 X
if (simple.IsSimulationRunning()) 6 G/ I. }: y" @9 Q% @" S! Q
WScript.Echo("Simulation is running!"); , W% }# E# V& [- G. l
: l+ L/ E! K" l/ ?% y, V// Wait until simulation is finished ' r* `! J- W( y- f
while (!Finished) WScript.Sleep(2000); # V: \# J# j l- g- ?. ~5 L
7 t M* @ Y+ q- z9 ?4 ?( o$ Qsimple.CloseModel(); 1 F9 H b4 u( M3 c, j- q2 G+ W) R
simple.Quit(); ; ]. B( T+ l1 l8 T, E
WScript.Quit(); . f- z1 j( }' r
# h. D4 o: h- n) y% ^ 2 g' ]" m5 g# w* q$ Z8 L, O7 m
function RemoteControl_SimulationFinished()
$ _. x" g. }5 y$ ~, [{
4 q* [. F s* o; M7 R" |2 z. c WScript.Echo("Simulation Finished!"); |