Example of a JScript ) o- `& [ v6 x4 o
var vbOKCancel = 1; 7 Y5 Q$ L0 i) J. K7 ]% h: ^
var vbCancel = 2;
* R- d$ s$ `, @# m* X8 avar vbInformation = 64;
3 z/ m1 T1 x; | Lvar Finished=false;
+ I) r+ d9 P b. f3 Z0 f
! q! v7 V4 p( ovar WSHShell = new ActiveXObject("WScript.Shell"); 4 n) o; c: K" \, o
) h6 a) Z2 _% M% N& r. H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( _+ x$ G5 V& J / X p3 D/ [' n8 _4 F- ]
simple.SetLicenseType("Runtime"); & M2 y y5 X8 R! V5 `
) R' H" N, y' n8 G
try ) A( H7 Y& I; p, W: j% U
{
$ h: r7 D% I/ W, U1 q. H) ~- x1 m // Enter the path to a model file! + A' m& o d; v3 u
simple.LoadModel("C:\\Models\\Test.spp");
* k( F7 v. K5 ^5 Z' x) e} & a- o4 S! Z( E6 `( a
catch (e) * P, q3 e+ k# r& Z! V4 T0 A
{
1 g! \ j- ~9 r" \( z/ X WScript.Echo("Could not load Model!");
% {' U& `. O! h) T) U WScript.Quit(); & X; |; W- M8 u% N4 S7 S- o. f
}
2 |# m) Z$ \* X2 v8 a 1 O; J/ w$ T& ?. b# ]
try . V Z/ | K1 S6 y% X
{ 4 p: e: j. ~0 E, _ J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) L1 g; g% [8 c8 c r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; z7 M, m% _! G( V
if (r == vbCancel)
$ [/ Z, e: p1 }) O+ }- V8 B) R {
, r5 V, E; S3 u simple.CloseModel();
; ~; l' w: W" |: R1 J% f# \* y WScript.Quit();
+ Q5 r2 `6 u) m4 v6 m8 e } 4 q) _7 d7 Y& }7 c# ~% [$ |
}
5 s* ^0 r. R" R7 C5 F; Z
J1 x- e) S6 W! n$ j$ Z' Lsimple.StartSimulation(".Models.Frame.EventController"); - `3 B4 X7 M2 R* P: ?3 k1 D
! z1 r' c' }3 h, A9 D2 @, wif (simple.IsSimulationRunning()) - p& ?! X3 ?% o0 }, {$ S0 y4 m1 g
WScript.Echo("Simulation is running!"); & I" j# R% j* ^% j" Y! J
0 ?* `6 o7 b. t) i4 d( Q) }) u// Wait until simulation is finished
) P& `, o3 {0 v' N+ {while (!Finished) WScript.Sleep(2000);
7 ~+ |$ A" s+ j2 H ; \3 w% W# i9 h* G& }" f. R
simple.CloseModel();
2 a: D7 D8 }# M7 ?: rsimple.Quit();
' R; X2 s% K' R$ Z9 O) UWScript.Quit();
9 U n# K# R1 Z, i3 u9 t2 \9 q- ] . g8 o* n- K: Y
% J' ]) h8 Z/ I3 R
function RemoteControl_SimulationFinished()
1 ]3 T+ w5 R& J5 V/ m& B7 T{ ( M. @+ c) N& B4 J3 V
WScript.Echo("Simulation Finished!"); |