Example of a JScript # a2 h% W2 ]7 q1 v& G( r
var vbOKCancel = 1;
1 P1 V7 Y, {7 V1 u# o% d* svar vbCancel = 2;
7 l! v! H$ k$ k) fvar vbInformation = 64;
- _4 c2 S; s& i3 \3 F' U9 v& fvar Finished=false; ' F# l% s( S! c& _; N/ x
3 C( c" g' J+ L! W8 zvar WSHShell = new ActiveXObject("WScript.Shell");
+ T4 E; F' K! J * X( Q) J0 ^: b- c: o' w6 }
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. c+ E9 }$ `9 Z# C% v8 k8 B 4 f* k/ `7 w2 u
simple.SetLicenseType("Runtime"); ( }- |: `' r6 r1 w
/ Z1 D9 B, t$ v- t7 E4 q3 j O
try
9 v- ~/ [8 T" n' R{
2 L! K/ h# ~+ _0 L1 }/ p // Enter the path to a model file! 2 U. t% Q( ]4 l& F+ K
simple.LoadModel("C:\\Models\\Test.spp"); 7 t. I# J1 D5 S4 h6 H* T" n
} ! L2 V- |. D1 z# M1 j" f8 p! Y. _
catch (e) ' h8 q1 E, ~" S- m! b: }
{
; b7 k, j Y+ p; y9 l) C WScript.Echo("Could not load Model!");
1 f5 @' O, U9 c. J5 l; Z9 ` WScript.Quit();
# a* B$ D& k, y' K) ?# M} & f& [5 Z: s1 }' U& w
2 R2 o5 l3 e# a# e: c- xtry
, H- E+ d! r( }9 N{
# j( {: b( x6 q# b" D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, J# [9 B8 C; c5 j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" u- e9 M& E! Q if (r == vbCancel) 3 o4 Q R! H2 F6 s
{ 3 p; b' {! \7 ~2 v6 E
simple.CloseModel();
) }1 t( X' O/ f4 N3 n, ^& h WScript.Quit(); 4 w4 D+ R- N f' p/ _3 C- \# |
}
7 q* c# ], N7 l4 e% z" B}
- G! F e9 x& R$ I9 { , p6 u7 J: w6 w4 J: g
simple.StartSimulation(".Models.Frame.EventController");
$ H+ ]/ ^4 ~, k0 C' d, E$ U
+ @/ Q# Y7 q3 M! N/ T$ Wif (simple.IsSimulationRunning()) 0 N+ z8 l, }+ h: G$ f# Y
WScript.Echo("Simulation is running!"); ' g. h$ Q5 {9 l4 W% J' c0 @* L0 Z
9 x. l' o) ^* r: [3 r// Wait until simulation is finished
5 n- k( `- ^2 D+ W4 Rwhile (!Finished) WScript.Sleep(2000); 1 p6 \5 w* |# r: Y8 I+ x, x) T
- _7 Q; A0 C/ @* n7 O/ Z
simple.CloseModel();
5 E# `; l; U, V% i& C/ f& C" `simple.Quit();
) o d ]: @; R( ~5 X: d. GWScript.Quit();
5 [ w% G+ y+ Z* Z & ~" W7 |* h( t. U9 Q- F6 e
) f3 f* q" Q- ]/ A0 W2 V2 B% x: A
function RemoteControl_SimulationFinished()
8 i* N& O. E1 j+ s{
8 p+ t" V* y, L) m, N WScript.Echo("Simulation Finished!"); |