Example of a JScript ( n7 ]& B3 [8 ]
var vbOKCancel = 1; $ P6 p4 V: u) j9 |! q
var vbCancel = 2; / R; I) r; @" d
var vbInformation = 64;
N& d( x) K- e0 s1 c( { Z9 ovar Finished=false; ! b5 b, u* j8 O# Q. H; s7 y2 v; W
0 Q$ [6 C% L7 J' Z& l
var WSHShell = new ActiveXObject("WScript.Shell"); ; N" @2 G7 [( t/ ?% @" D; Y, X2 M
) w* G5 o, s3 N* I. W+ @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); , q! N* e) a" x7 Z- Q/ L
. |3 y* k0 s* {3 Y. L0 _- Jsimple.SetLicenseType("Runtime");
% C6 [2 J" Z7 I9 u ; X2 m7 I9 Q2 S
try 1 d, y' ]" I( u3 K# i+ H4 ^
{ 7 v( _3 O6 U5 }: P/ L) J
// Enter the path to a model file! " I! B! C. }) V
simple.LoadModel("C:\\Models\\Test.spp");
2 ]' V) f/ a7 e( ~! B} ; ?. Q) `+ h( Q9 t6 {& a# Z
catch (e) " u: T9 _' G! h: {9 W& h7 j
{
; i* s; C5 n; y: C M0 h5 ] WScript.Echo("Could not load Model!");
$ m/ |! z* ~0 r3 e, e8 q# y WScript.Quit();
6 x# F1 @( l+ r}
& }0 a& d! f. V 4 \7 W5 [$ R- J# g% Z Y% i
try
& X0 g3 e9 Z$ f* S" f{
2 J0 _" E& i. Q& C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ f, N- d( U, d2 N r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* b- E" f# j8 h- d+ n) J if (r == vbCancel) . S1 ]7 S( o [; h4 e
{ 7 [, Z; ^* k" b. Y
simple.CloseModel();
1 U+ r3 m/ g8 B- g WScript.Quit(); ' ~ ?; H% U$ I9 O
} ) R6 \* X7 o7 @ {
} # |3 L- X2 i8 Q2 H- I
& [$ ^: A# ~! N+ L
simple.StartSimulation(".Models.Frame.EventController");
7 {; C5 w, L: A' x6 B* Z# s4 V3 w
' ?; J5 M0 ?0 Qif (simple.IsSimulationRunning()) - b/ U% T) A# T3 Y* s2 q' f
WScript.Echo("Simulation is running!");
! m! i9 a3 ?& m9 U$ t( Z( U * @! p& n/ v5 u X
// Wait until simulation is finished
6 S; z- W; M; r5 j6 {# F, ` l4 a& Fwhile (!Finished) WScript.Sleep(2000);
. f5 q0 b$ `+ M/ r- k 4 B; A( @0 Z2 o! T* a/ j; P* |
simple.CloseModel();
, }2 X# u l' [! F9 T: R7 psimple.Quit();
7 ^& P' K0 Q( G4 H* @8 [( H( WWScript.Quit(); ) Z# k# C/ {: a# `4 S6 K- G
/ H# b2 }, U" u4 d
# m! M- o4 Z* k3 l. H* R
function RemoteControl_SimulationFinished() Y4 v- y. [8 ]' ?
{ 8 K) X$ A" n, U9 b; G' f6 |. f
WScript.Echo("Simulation Finished!"); |