Example of a JScript 8 H( R+ Z1 k5 H# h9 @3 s
var vbOKCancel = 1; 1 O! A$ {; p3 {) D: K8 K& [4 z1 K
var vbCancel = 2; ( l- j7 U5 l2 z; M& Y h0 |' @
var vbInformation = 64; - }. m$ w3 Q4 R8 z$ m; p. G
var Finished=false;
; S Y6 p m. ~
2 D/ f; M+ I4 u) D, P5 O6 Kvar WSHShell = new ActiveXObject("WScript.Shell"); ( F9 e- D6 t1 M% T- v/ a+ ?- f \
! d1 R; R, |' c9 i- m2 V5 y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& R8 ~* Z* L1 r # v5 t' \: h9 ~' u, b9 [
simple.SetLicenseType("Runtime"); 6 _$ K9 M' o5 U( [- l0 c( U
1 q/ X' q i. ~% h7 V( Atry
$ n4 A! s% [5 z8 X7 U{
* ^+ j5 D* r: k; A // Enter the path to a model file! ; j. i# g7 v. R8 A) F# [- h
simple.LoadModel("C:\\Models\\Test.spp");
: r4 v& d/ x2 I( |8 J% W8 @}
+ R! |) p7 F+ B' k( ^catch (e)
8 c7 _6 R6 e7 y' c2 \{
' q& M+ _; p5 L3 ]! c- M WScript.Echo("Could not load Model!");
' t2 F" }0 _* i" D WScript.Quit();
0 u& x7 U" D/ w/ C' y( E}
( V/ ]0 ?" C+ i / U# L, o/ [# n) Q/ D
try
' o: x' c, s; \{ - u3 N# }0 \3 W* j, |
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 |& u' S0 v" d y' w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 x. B0 m( N7 H" C7 J if (r == vbCancel)
# P" d% D; y+ j& P$ G" D1 e {
1 g' O; I" |9 h* L1 k _ simple.CloseModel();
9 x1 G& z& H4 M* M& T& V4 ] WScript.Quit();
7 h) A! v; d# O S+ K }
. c: }! x8 C( L8 j2 P" M% h}
2 v9 z# {3 J# x6 z' c9 ~* V8 H: y
1 \* }7 w5 ^6 E1 s- gsimple.StartSimulation(".Models.Frame.EventController"); 2 C" M9 g2 C$ c' ?+ _9 W) A4 p* y
' K: Q( j9 \( E* F& R
if (simple.IsSimulationRunning())
, \$ d0 Y! \1 @) W1 `# I% W WScript.Echo("Simulation is running!"); # [! k# E. H. i1 r
) ?2 V# }" c* F! B0 t
// Wait until simulation is finished
8 B0 B" }" q; {' ?while (!Finished) WScript.Sleep(2000); - [# ~# \+ E9 ?& q- D( h* y
/ f0 g) w: \( B6 v
simple.CloseModel();
2 f0 [: R9 V* y$ o& dsimple.Quit(); $ C, `" m' p3 J$ c2 D
WScript.Quit();
! U' X6 A" n) h4 y& p5 A : {5 Q9 H, p- u" N) Z! z7 R) M
& c; ]8 J3 S) g0 s: Gfunction RemoteControl_SimulationFinished() - d9 K3 G+ ~& N9 }8 [
{ # ]7 ?2 g, e1 P3 i& c1 `
WScript.Echo("Simulation Finished!"); |