Example of a JScript ) \# G: v3 Z k- L
var vbOKCancel = 1; ! K- l i6 p, v* F/ @% K0 N
var vbCancel = 2; 0 f/ i; `+ K8 g/ J. A7 _7 P
var vbInformation = 64; / p/ B' a1 ]/ P- M$ L V! d' i7 p
var Finished=false;
, c# J: o6 B' \: ]+ u9 F$ ^ " k7 K7 f8 l8 i4 ]
var WSHShell = new ActiveXObject("WScript.Shell"); 2 S. w H, _* u0 S6 I: i
l2 Y$ r9 t$ q( tvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); W i& C0 w+ E' P3 B+ n0 F
3 K2 `: c4 h! \! Z7 S0 I7 @* x
simple.SetLicenseType("Runtime");
4 `1 d1 F( E. R . n) F$ K, ^- F4 S" N3 t+ q( ]
try , {. M2 R* b; J P1 I# F( x
{
: `' Q3 Z9 u/ H8 A0 J7 U/ A: @ // Enter the path to a model file! 4 H0 R' l% q; h) h) U' _1 h
simple.LoadModel("C:\\Models\\Test.spp");
9 G# D# R) y! a, b}
- I9 i9 T7 k& n7 \' @, J! A; `catch (e) 3 m) ^4 K( r# n' d9 \$ x7 y
{ ! t% X3 a% |) ]8 U' L' D
WScript.Echo("Could not load Model!");
& f) I7 t9 d1 ^" W$ v WScript.Quit();
, W1 T& o2 X; ]5 b/ \}
! \# Y! V% {7 c1 x% z5 R
3 q! N8 P3 F6 W% Ktry
: P( E4 r' l7 w8 t5 K{
f* h; n: C+ e# ?" i* O/ y- m" |8 ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 B4 S. s. Z1 m! ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & {3 n; k; v7 N4 \
if (r == vbCancel) % P1 s4 G# M6 Y! f [
{
7 c: `6 g* ^0 ?+ U* L: |1 n. b7 G, b simple.CloseModel(); 8 j0 t! n0 L. D, L# d4 _
WScript.Quit(); , T2 J- t( H/ Y- R
}
W6 \6 G% a4 C: `, q+ v}
( e( f9 y! A+ G2 s2 t2 b
: s' M' c0 }0 zsimple.StartSimulation(".Models.Frame.EventController");
" W9 m# _8 k! m1 U, b! }
9 p# X; `! L& X @. `' {; B# hif (simple.IsSimulationRunning())
2 S, [$ z2 a9 c2 ?2 ]6 a WScript.Echo("Simulation is running!");
& Z$ X+ j6 _) z/ A9 U
# ]2 S4 x" R; z/ E0 [: s, ~* P. ~// Wait until simulation is finished 7 B6 { {8 H/ n
while (!Finished) WScript.Sleep(2000);
" P" k7 l" X: i7 o6 i ( q' P9 X" n" h' _! r
simple.CloseModel();
7 q3 Y7 [, P9 \1 k" u$ `simple.Quit(); ( H0 @* p, `% H8 Y/ z" S. Q
WScript.Quit(); : W( ~, I6 |6 Q& I4 W
! t$ I) }3 W8 a
" Z- u8 E, Q7 V# D$ b6 vfunction RemoteControl_SimulationFinished() 0 P2 o% `' z3 z+ P& _
{ 1 s9 K$ j4 |6 }- C
WScript.Echo("Simulation Finished!"); |