Example of a JScript 4 B8 ~ R7 J: S6 D1 [6 \; F
var vbOKCancel = 1;
) Z% j9 I1 m# `2 J+ I) y5 i: Kvar vbCancel = 2;
3 ^6 h( Q2 i3 n. A0 n s7 Y% Nvar vbInformation = 64; * p- s: W( {1 O
var Finished=false; $ Y+ m- |: M. z
# o1 ~- t8 T* P) ^var WSHShell = new ActiveXObject("WScript.Shell"); 4 M5 m, B: {& |+ W |/ y' Q
$ p. e1 P, K' i8 \' {) S* w Qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % b1 N: k( W4 F. N
; m7 l' G4 } h) N. Z' U( {simple.SetLicenseType("Runtime"); b) S) \2 v7 g5 l' r
/ O% ]/ ?, @/ Z" ~ E5 ?: s, dtry
: E/ m# V$ [+ N. q7 {0 t( n{
/ _! w% K; Z+ Y6 s // Enter the path to a model file!
& o, u9 @4 {' r5 _. Y- f( b simple.LoadModel("C:\\Models\\Test.spp");
0 c8 E& Z* b& O, [}
6 y; b- h- K+ z _* T: }) B7 h& {# ccatch (e)
6 _2 i" t$ d" ^3 |{
- f' |& F( M9 A J WScript.Echo("Could not load Model!");
* H7 S: J8 i: } WScript.Quit();
* U, Q- B5 W/ S: p8 T! X8 }} 6 x! a) y$ o- O$ l; h
$ T: a* ]! n1 [1 w% h1 Mtry ' m& Z4 p) j0 \5 Q/ a
{ ; ^! r( L3 J9 L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
- Z3 g# R- _4 t# x* ~+ c9 T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; g0 Y( J/ r; V2 Y A. ^/ g if (r == vbCancel) 9 |$ Z! ~ j! y) a
{ # m7 m1 w/ H/ [7 ]( F1 \* W( S
simple.CloseModel(); ' c2 c- m/ D" i
WScript.Quit();
- f T, |3 h) Z: y }
; c0 p; J0 e- W5 F: a6 ~}
0 n* `1 c2 `; ]# ~+ @1 e - k O* S8 p1 w& G- Q r
simple.StartSimulation(".Models.Frame.EventController");
& {$ F4 v8 d" Z2 O* H, w1 Q4 K$ ~
' K3 S7 v0 T( e+ m2 Mif (simple.IsSimulationRunning())
; D/ t+ Z) z P) V WScript.Echo("Simulation is running!"); ! P( U& H+ R3 H2 j$ a
5 {8 v( b' o' A// Wait until simulation is finished 4 t# P+ H3 T! w: I
while (!Finished) WScript.Sleep(2000);
: Q, a+ U* y6 I4 j6 R
6 t! V5 }) N: X) k$ |# v& X. }simple.CloseModel();
% `" G: E! R) ?; |2 nsimple.Quit(); / ]7 t, g1 F; F8 B! c. e4 W1 ] q! l* k( N
WScript.Quit();
8 \$ O& _0 `' y3 ?' k) { ; B3 l4 ]& w4 X! M
8 E9 _' x8 S! h9 E5 C: @function RemoteControl_SimulationFinished() , @$ h- A* h; J% \8 U
{
, ^, f1 ?- g) j, B& K! ? WScript.Echo("Simulation Finished!"); |