Example of a JScript
- P& Y" E8 f5 X- ~+ Kvar vbOKCancel = 1;
. l# J5 m/ K! s3 Pvar vbCancel = 2;
$ M; h3 C( C$ [' P s/ jvar vbInformation = 64; 8 U. `1 _% v5 u2 g7 G/ S2 v2 i( u) _
var Finished=false;
( @1 b' s$ m% m6 `" u
% u8 z0 V$ F) [/ a, wvar WSHShell = new ActiveXObject("WScript.Shell"); ! f) ^ H% J7 N X- k& y
e1 u9 u! s b$ W6 ]+ _3 w. }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' P# Y7 h- d- L6 x ) H* z. a& U8 C, b
simple.SetLicenseType("Runtime"); $ ` k0 V: V$ O8 P9 R7 P
+ H5 h- C. I4 b5 T6 s6 Ltry
0 e( e- j& w7 j# n& e{ - ]7 f( B' }/ x: g9 Z& b
// Enter the path to a model file! 5 x G. E! l2 z" E
simple.LoadModel("C:\\Models\\Test.spp");
9 N: U: e. I0 l& K3 n2 S# P}
! A1 U5 o) z5 K4 Wcatch (e)
{" g: {9 e2 i: i% B{ 2 z: M( r0 H+ Z( |. `7 @
WScript.Echo("Could not load Model!");
4 n `2 i4 o" T4 \! R' J0 d3 K WScript.Quit();
# R, D8 K* V H0 t}
( O+ G0 y) D1 G 2 X( O8 G$ y+ R6 p/ { C9 ~
try
" U% I/ e, k; i1 P{ " h& j; Y# r8 I) n* w1 f2 g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & A) B/ x, C7 V9 y* s# K {# b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); " q9 A8 L. p- d8 H- L8 G
if (r == vbCancel)
- a+ J0 N7 o( J% e2 u5 Y) B {
& ~ \3 H1 p: C- k$ F+ H } simple.CloseModel();
' j9 b" \7 j7 u9 _& Z5 W: t WScript.Quit();
) i4 B+ H* d- S } 7 h5 @% ]1 @$ f7 ?
}
8 X6 O' _! o3 T0 v. ~ * ]; u4 l: Q* _; \$ w
simple.StartSimulation(".Models.Frame.EventController");
' D9 c, Z# N5 Y& r
# ?8 y+ q9 ?. e1 N, oif (simple.IsSimulationRunning()) 3 q5 e7 N7 i& ]0 d
WScript.Echo("Simulation is running!"); 4 p9 y9 L' \3 c @: o
, f1 F8 j$ j% M) a' ^/ x* a2 F
// Wait until simulation is finished
/ Y! @/ t% S3 L+ q! e4 U& ^while (!Finished) WScript.Sleep(2000);
& b5 Y' L( B5 X ! z \8 F0 B3 D' X3 s( C9 [
simple.CloseModel(); ' `$ D3 C( u( f( [" ~2 N- K
simple.Quit();
# w& v5 Q1 T1 mWScript.Quit();
$ p& L, i1 s- S: T9 D & _: S: s8 W; v! h# X
, t m: |7 ]7 r$ e% B4 ufunction RemoteControl_SimulationFinished() 2 r! D' i; t3 e
{
9 s `; `, {/ O WScript.Echo("Simulation Finished!"); |