Example of a JScript
, r7 B2 w7 L$ ?+ p% r9 Dvar vbOKCancel = 1;
. j9 G" d: I: U: x4 V, X9 Q$ Yvar vbCancel = 2; 4 `" p& e' ]: y2 x: B
var vbInformation = 64; 8 {( R( [. m: G: G Q/ i
var Finished=false;
6 y+ o6 }' Y& V( ]
8 b4 P9 ^$ u1 {8 i m1 Uvar WSHShell = new ActiveXObject("WScript.Shell");
: D& v8 y7 T' b. c( Z; T: a ! \- d. L/ i6 A; Y; R- }6 y, n
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 k y2 F% J" G; ]4 N 2 A6 y, Q/ ~4 `5 o0 V7 A7 R/ Q5 @ h
simple.SetLicenseType("Runtime"); - }. B- T& q/ I" m! W! ~
% x5 _1 C& G3 ~3 f, W! `* l! Stry & G9 P, M, H: C% S" e# L& b0 u
{
9 z0 z" |% w/ \+ H // Enter the path to a model file! + r9 @; v6 f) L( ?+ e
simple.LoadModel("C:\\Models\\Test.spp");
! _7 P5 S& D' J, n}
0 P( ], v2 \1 c! @3 F% wcatch (e)
2 r* o/ X* s3 X- w{
& P' l2 c1 E$ @( r w, o9 i WScript.Echo("Could not load Model!"); 3 z- x& U6 A" u) @
WScript.Quit(); ( E- X0 k3 g4 u3 {8 Y, E5 \
} 9 y" ^2 ~) G8 E
# f7 r3 \% y3 c5 gtry
0 m m8 ?6 V1 Y{
9 }$ b1 Y& L' {2 C' m3 p simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + n. e, q/ w2 {" O: [$ S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 W# ^' z( M0 | g7 q9 D if (r == vbCancel)
6 e3 X# N5 B5 _ { ) t! D2 Q4 p9 |2 |8 p7 v
simple.CloseModel(); $ D/ p" S2 @$ B2 g/ V2 ?/ q% t
WScript.Quit(); + t* v' ~! |8 k3 g: |8 n* }2 v
}
1 P! n, @8 j. B- M5 U}
* N6 Z0 m1 m5 z' W- M 6 O( @0 y) X$ ^, q B
simple.StartSimulation(".Models.Frame.EventController"); 7 J+ R# w7 b9 l& Y, T2 n1 u
' H0 ?* |0 k' N' F( S9 g* `3 [if (simple.IsSimulationRunning()) 6 N$ O& d. _" ?" q" q% w. }7 j
WScript.Echo("Simulation is running!");
8 I& I0 P& ^6 A; z8 q( h0 V1 T# l: B9 C p. w: J* e- v h& u. K: w
// Wait until simulation is finished
3 h) q0 ?2 l) A3 {, k; ]4 Kwhile (!Finished) WScript.Sleep(2000); 8 C1 r- @" Z% T% ]8 m- u6 [
2 M- h# S# r0 W4 l; [$ h5 [) A/ ?
simple.CloseModel();
' t1 |; ?8 h) _+ \; Q; b8 ^simple.Quit(); 0 Q# `1 q* E: a0 \
WScript.Quit();
^( R1 g9 G- g
$ ?! s! |" \3 G2 ] & Z2 i7 |! u) l+ ]5 g
function RemoteControl_SimulationFinished() 9 J; _( m$ }# N, ^. W9 F
{ 6 q2 i7 v) u% ^. _
WScript.Echo("Simulation Finished!"); |