Example of a JScript 6 X, S7 {6 n: Q- Z
var vbOKCancel = 1; 1 E y( `4 f0 b( N2 y6 C
var vbCancel = 2; 8 H* F' j& I) ^' d" ~/ A' \* R' @
var vbInformation = 64; ! ~) i1 ~; A& Z
var Finished=false;
: F. k: [7 a7 V8 o " x% p) C$ l' Y' C
var WSHShell = new ActiveXObject("WScript.Shell"); ' w, q+ U! S5 i6 t; X" u9 z( O
. {# K* H" ~3 x; K
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . {3 w5 \0 n8 G* W/ g" D9 }4 ] R% m
j+ W0 y. U* {' p/ e+ f
simple.SetLicenseType("Runtime"); $ F* O0 Y8 |& N' L3 }
* v g0 y$ B& @% m7 `' S
try % s2 C" I8 ^/ a$ q$ R. l. T
{
$ s. K2 s; j6 v: k8 [1 M. m // Enter the path to a model file! 9 J% Z) A/ B V* w1 p
simple.LoadModel("C:\\Models\\Test.spp"); / R+ o1 v) r& t2 }, G5 q
} ' ]5 C/ o( R% b+ Y2 X0 n
catch (e) " _: P) a1 Z# z" G5 t8 Z" M
{
7 c# X. H; @; {: J# f, ~ WScript.Echo("Could not load Model!"); 2 [. A& f, \$ y& Y8 a, X
WScript.Quit(); 6 P4 M& [3 S0 G
} i' M( J. g% j+ \
& D; K% l7 k: O! V, Q+ ytry 3 F. h9 o- H& d( D( ^& P
{ ; E" |+ w% T' d9 J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
p$ c* B) [4 Z1 j2 e- H r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % L* l9 @ E5 b/ J n1 S' O) ]9 H( M
if (r == vbCancel)
- W- m( x- B/ Y$ I1 | { & S$ x7 c5 B( ~: M/ U
simple.CloseModel();
: D& k4 c j1 s6 d$ G: R WScript.Quit();
3 s* d& ~/ [ n8 X! T4 x }
& t1 D+ k, U- Y( U}
9 P8 Z F5 a, O' S. w1 k 3 n& ~8 H# s1 Q+ z4 l# j
simple.StartSimulation(".Models.Frame.EventController");
" j6 j; w- `/ H2 ?
, ?5 k( g# [3 `8 sif (simple.IsSimulationRunning())
% z9 w8 l" v: a1 C! f4 W WScript.Echo("Simulation is running!"); ( v. q: D) }- `+ T, @% f- }
: I9 a1 P# k5 Q: b- b# I// Wait until simulation is finished / i; J* o6 U! G
while (!Finished) WScript.Sleep(2000); ! Y2 O$ m: S; h d8 E
) u7 q/ D: v, E* a1 gsimple.CloseModel(); : B, c; d; K1 i: p, B' W! q5 s
simple.Quit(); / j R/ B4 C, u \
WScript.Quit();
" e! Y+ n9 z8 U# i. v; p% m 7 @5 ^% H2 Q' }
8 q$ _, I$ @3 K! d$ gfunction RemoteControl_SimulationFinished()
+ O' T B2 H! s; j7 l) `! I{ # n" f# W5 ?. F% ^
WScript.Echo("Simulation Finished!"); |