Example of a JScript ; a3 S- K s% ?% c% q
var vbOKCancel = 1; : ]' j6 F! J9 t* m; i5 k0 v
var vbCancel = 2;
& _+ r2 E: b# Z! f, q& @0 j0 wvar vbInformation = 64; . |3 b2 m# Y2 x! I2 v
var Finished=false;
5 ~6 s* {7 Z; r# I
+ [& t: }) ~: l" V" Fvar WSHShell = new ActiveXObject("WScript.Shell");
7 u6 B4 c1 D& h/ ]/ } - |, q0 ^* E1 p: |2 J
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 a9 j3 o$ l* F8 n. p9 I- L
2 u9 q+ [2 }& vsimple.SetLicenseType("Runtime");
4 P3 X" Z' W# n; S4 b2 {+ b8 E* W
4 {$ Q' G& G$ D% |; u( Utry , X9 @* _7 A- H' |# K+ J/ Y' j
{
2 ~5 d8 x$ `5 \! Q // Enter the path to a model file! 9 h2 N& s' [0 W! q9 m$ r2 q
simple.LoadModel("C:\\Models\\Test.spp"); 7 j3 @1 }# M% e: x, Z, m
} ' H( W% x+ {9 F( K. b" W8 X
catch (e)
$ G. |/ p% T X) ?{ i% k( j( |5 A' g0 S q/ {: I; S4 @
WScript.Echo("Could not load Model!");
1 x. I1 l9 |% |1 b3 Y WScript.Quit();
( O- V# `1 R% d+ ~% }4 D" S R} / r2 A5 q( |" Z6 q1 G/ b7 t
" ]1 |& M- |$ i i( W( P1 r6 e
try
3 X3 t$ E: Y E# @- I1 w% j{
8 W8 ]% v4 t3 A3 o8 K2 j simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 z) E" I: J e+ y s( Z1 ] r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 C" E- E+ a) x* G, {: {4 Q- o! R! o ~
if (r == vbCancel)
R ]. w8 X7 w% v { + A" G X$ u, r$ w: s
simple.CloseModel(); , }7 e& E' F* U8 M! }$ _3 V7 e
WScript.Quit();
: e2 i- @ ?: M: P; Y- o5 D } % V- s8 b$ q- `* g& K, G" e
} . o7 W, J# h3 a/ _. Z D
8 @1 R! J! E! L5 o [! Z: w/ S* h
simple.StartSimulation(".Models.Frame.EventController"); & g0 s# U+ Q9 Q0 f
; {7 V$ V1 V5 d( Gif (simple.IsSimulationRunning())
5 H5 w/ o! j% k( ^ WScript.Echo("Simulation is running!"); 2 l& F5 w9 w# t$ M# q" \# J
8 F8 P; Y* f+ }
// Wait until simulation is finished / m0 U! Y( ~6 N% c" L A
while (!Finished) WScript.Sleep(2000); ( g7 z* u w7 w9 V! Y) E
# ?' K6 O( P# e7 u1 O0 W1 L: ^
simple.CloseModel(); $ ] A; \. o8 R& i, y4 f. t
simple.Quit(); 7 I/ C) |: F: ^; q$ V' t; |5 o
WScript.Quit(); % w% D& s' K) \ G$ {4 }- n( L' u" }
" T! U+ f. j, H9 w& y9 o! C
. A. M: s! E# k1 n7 Zfunction RemoteControl_SimulationFinished()
; X' G) \) q) V4 r( L2 E$ u) Z{ + j* E( A4 A, z
WScript.Echo("Simulation Finished!"); |