Example of a JScript 1 E# Z+ v+ H( L1 Q1 K
var vbOKCancel = 1;
+ n- n0 A5 y1 q% vvar vbCancel = 2; + ?) \5 _7 X% V w0 `3 I
var vbInformation = 64;
) ?4 T5 N' A% P( w4 g0 ~var Finished=false;
% U$ ^2 Y% b8 |/ |( d. @% ^, p/ O/ t - z% B* p- m a* P) x5 ^+ k% E
var WSHShell = new ActiveXObject("WScript.Shell"); ( U1 ~* O; U* e: R+ j# M
. _( r* P! h0 Q0 U
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) l( H s3 e8 R# Z
! f! R* L, h# M. T" Bsimple.SetLicenseType("Runtime"); / J! V4 n; C9 f
$ _6 F+ K0 ]* q0 h P; v
try
, p2 j7 Q$ t! j6 u{
& Y8 V& I$ l# } // Enter the path to a model file! " l9 r. O8 Z3 p6 k3 a
simple.LoadModel("C:\\Models\\Test.spp");
% O0 C1 t$ h$ v8 o+ u, c} # n' f) G) o; g$ r% N
catch (e) 6 {# O1 r& f' c" L p2 M
{ ( |& c! ]+ z3 \: L, B2 {# `( b$ k
WScript.Echo("Could not load Model!");
. }! s* V1 C) T* P& x5 { WScript.Quit(); 3 d" p5 ?6 v- B: g$ d; q
} ; p5 ^2 A. |' [( D+ h
! P% O9 ]1 D, w6 p6 r9 z( t- j7 V
try
5 l! ^$ S1 l. s{ 3 ?( x( V8 E8 E0 y+ O$ I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* y! R/ G9 x( F3 S2 w9 E5 d5 V# r# w r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
+ j1 T( t4 H! u. x if (r == vbCancel)
+ T5 K7 T( t2 _- s' j& t% F {
' ~. j& ]# T% [7 i simple.CloseModel();
0 F! s3 p' p8 z+ w) ~! ` WScript.Quit();
' N# l% K6 w( B2 ? B' ] }
7 [6 T: ^. g$ u7 }! A}
) M! _- M3 x( x / t& J0 s5 R9 m; e& D
simple.StartSimulation(".Models.Frame.EventController"); [4 F0 ?: j: o* m" e% c
! l: Z9 B |- Y6 c+ c8 Hif (simple.IsSimulationRunning())
/ D+ m4 `3 l7 }7 E' j WScript.Echo("Simulation is running!"); ' d$ }8 H8 v# l8 L
8 v0 x( V0 V- W// Wait until simulation is finished % h6 h3 D8 T$ w
while (!Finished) WScript.Sleep(2000); + z, S* O6 p* n9 w k
0 Z* J) Z* J. v$ fsimple.CloseModel();
% y' V8 b. q7 S3 Gsimple.Quit();
/ y# Z2 e5 Q" h: _: l1 ]WScript.Quit();
[ w1 t! `! ~6 a4 N6 K $ R; K& t" T8 y4 {
; H; q4 R6 ]* ?/ k9 V/ gfunction RemoteControl_SimulationFinished()
* y- f) H5 U c' E8 h5 h{
% }9 `6 |+ s( C8 k* L WScript.Echo("Simulation Finished!"); |