Example of a JScript
+ D/ b/ b: [, `0 {+ t) vvar vbOKCancel = 1;
. o+ G5 F m2 x1 Nvar vbCancel = 2; 0 T4 U: k9 R9 s1 d0 q/ O, A
var vbInformation = 64; ' ^% q" _8 o8 T$ m6 B
var Finished=false;
. W( t) g) _5 W2 I( U 8 b( F3 e( H, _, T: o0 m
var WSHShell = new ActiveXObject("WScript.Shell");
& c: a$ {+ i' Q " v& R. C9 N+ N* N$ \# s( y- i( R; E6 l
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! C* ]1 u4 M' E$ b
" r1 y, m# K; c u9 h( j
simple.SetLicenseType("Runtime");
- G; }/ |5 S2 _1 {' Z8 x
) F1 u" i! N6 ptry 4 }4 }. c4 q+ y
{ ! c1 i7 ]8 [4 [; Q4 X
// Enter the path to a model file! , ]) f( }5 _4 J; y
simple.LoadModel("C:\\Models\\Test.spp"); ( ^5 X, y; e$ Q" @% [7 h/ b$ [/ q
} ) z2 E. D1 q2 [+ m# |" _$ x% C
catch (e) / E3 Z- Z# @: C" D, _
{
0 h6 R) {3 X: h" R WScript.Echo("Could not load Model!");
, o9 q. z8 v8 V$ ^& f. V/ X WScript.Quit(); 3 A) j6 {3 Z4 A8 A8 V# r* ?# ~
} 5 B' A% ?6 o1 W9 r6 D8 G
$ ?/ J I1 H/ L( q% Mtry % t X" K3 C8 d% e
{ 0 |, i6 G" S/ s8 n
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 6 v D1 L$ P8 l+ b0 }5 g
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * V, i! k7 c6 [+ c/ }
if (r == vbCancel) 0 X$ `. s' b" ~/ W: C3 Q4 `% R
{ + }4 l, `7 Y, s; @9 p: `* Y
simple.CloseModel();
8 a7 U+ A& ^* p WScript.Quit(); 6 x9 K% F) C& U% }
} ( t$ J+ F* i# A
}
9 R" ^4 i- F/ f
( |0 S5 W1 j& |5 ]$ a6 @) ssimple.StartSimulation(".Models.Frame.EventController");
+ d2 `+ `) y, o3 I Z 9 t! g. w; w( I) p+ Z7 d- w4 R
if (simple.IsSimulationRunning()) , E/ u/ J' }% U& N- E& J
WScript.Echo("Simulation is running!");
) S7 Y( ~$ \. ^* L - \# u2 c" \! `" e
// Wait until simulation is finished
$ ?& D+ u; n9 \& ]while (!Finished) WScript.Sleep(2000);
5 J, a8 \% p9 L0 o8 X
, H; w+ U& `' W+ U5 Y! s2 vsimple.CloseModel(); , n+ s* e% k5 _
simple.Quit();
4 ]- q: @+ w0 CWScript.Quit(); % s, Y8 X$ \' c4 |3 b
" T |0 I2 o- Q' j : l$ ~' M7 ]; Q
function RemoteControl_SimulationFinished()
" M$ [" O8 `5 h1 e1 A{ " m7 x: R+ I) I6 I0 H
WScript.Echo("Simulation Finished!"); |