Example of a JScript 0 s. b; r) k# J+ R5 C
var vbOKCancel = 1; ; Q/ {: X3 r, Z, h, |! S
var vbCancel = 2; & ?, U, f) x6 h" S. n$ S
var vbInformation = 64; , B& F( e8 D c1 z) P5 q4 v
var Finished=false; # ]) t4 ^ y( h, s
" `- ^9 r/ c. u- w! }var WSHShell = new ActiveXObject("WScript.Shell"); / K, L$ Z2 O9 G2 o7 e
/ c4 L; i& b8 H | {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 j+ u* i2 V; r$ @6 p% C: d* ~9 X7 o+ V ~2 v+ {- p9 ?8 w- R V4 V
simple.SetLicenseType("Runtime"); $ @9 T2 [+ B7 x H* | h6 w
& M5 F2 x' f$ ^2 [! e5 I
try : q. y0 [, t* R
{
h0 @5 {; g) H. B* M, q // Enter the path to a model file! 9 l {" k1 ^9 Z3 `5 Y
simple.LoadModel("C:\\Models\\Test.spp"); 7 b1 q/ S9 ^+ g Z
}
5 `& F8 c, S* y5 r. a# e" ?catch (e) $ Y% u1 E+ H2 k
{
* i+ H: g" o: f8 S; Q WScript.Echo("Could not load Model!"); * w6 d! w; ], w' c2 Z# C
WScript.Quit(); 1 e# y5 Z2 x9 |% F2 ? W$ [, v! M
}
H+ D! b# P; K9 K
' |7 n+ E8 G {( _1 \: o+ Stry
, a- x' y2 a) h- e ~- q) C" [% C{
; ^5 `: r! n( V0 B! L0 { simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
6 i p5 d0 H3 R9 Z& m% s& X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) H" b* w3 R0 x
if (r == vbCancel)
( g6 M# P+ f$ J9 g* M& @4 P { 4 E5 i0 j6 P- u) w; ^$ Y( G' q6 q
simple.CloseModel(); ) J7 P! @* q7 t3 l/ N1 l B
WScript.Quit();
5 F! ]6 k7 j! S; c* x9 i6 J }
# d, O6 F8 h) B, h! q} : h# T" U9 ]: U. C4 D
( g" w/ m5 T3 d# {
simple.StartSimulation(".Models.Frame.EventController");
7 L. U4 t, G }# n( R* p ?
e5 r% W, w- a# P9 Dif (simple.IsSimulationRunning()) 3 B4 {# d( r* l) {+ x/ I9 F
WScript.Echo("Simulation is running!"); ! f& W5 U L% L
2 O6 [+ T/ x8 n// Wait until simulation is finished ; q) ~$ h/ w4 P) I7 w
while (!Finished) WScript.Sleep(2000);
" J3 {6 o- L3 `* T+ b , g% @( h9 C P- M% U# I0 n
simple.CloseModel(); - a, Y# h0 D: d1 Z& ?
simple.Quit();
) ~ ` o, q. A D- l3 G |0 \WScript.Quit(); 0 t- {# P+ w8 s" c7 Z
/ `- H+ @3 E+ Z% }1 ~
7 P# z/ p* J; x) Q: H) c7 o- rfunction RemoteControl_SimulationFinished()
/ q1 i6 |+ K9 T! p4 D{
/ f( n) [% E3 ?! _' [/ a WScript.Echo("Simulation Finished!"); |