Example of a JScript
, Y0 U; ~, a( T% \var vbOKCancel = 1; 2 B0 f4 K: {# Q8 K. N* ?, m( ]6 \
var vbCancel = 2; % }7 S7 i$ d; d- p, c
var vbInformation = 64; 8 L- ^" R! ?# ~5 S5 ]
var Finished=false;
4 F* `, w! T l- M M/ P, v
2 V$ E% d F/ g9 H0 |2 \2 nvar WSHShell = new ActiveXObject("WScript.Shell");
+ E( H$ ~0 ~: V3 ~
6 e' O( N0 i. A5 m* B$ [& Jvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 b5 }0 ?- p* D) K/ x9 y' q) I 9 D, d4 t* T1 N4 x% _
simple.SetLicenseType("Runtime");
8 g! _, S$ B) G! _( M5 o4 N; P ; C/ u1 e, ]7 g, [
try
2 i6 d5 f' Z6 ]3 q2 z{
4 h9 N1 {" j/ L) w: E // Enter the path to a model file! / L" H+ P5 D4 Z
simple.LoadModel("C:\\Models\\Test.spp"); 0 ]1 V# h1 K5 b8 S: K) A8 P* ?
}
$ H' H' X* F- `) k- rcatch (e) 1 H2 Q6 m+ z4 X+ b9 Y$ m
{
( f: R2 p9 ?/ N) h: B WScript.Echo("Could not load Model!"); ' h5 @& P( Y4 j
WScript.Quit();
% e4 B: e- D4 ]' |}
4 j3 l; N" ]1 _# T) ]
5 t. z( x& T" Q: [* d( O0 z0 K8 D" Wtry
0 i7 r$ Y, K$ s& U( V{
" |! d; d' \# T# z# J: D simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) [, I% `/ m7 O% S4 Q$ _$ w' R { r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 v$ A" e. U: e4 ^2 I D
if (r == vbCancel) 1 P2 \6 X& A. O, m5 o& ^
{
5 n d) |9 f# y6 b3 n5 V simple.CloseModel(); 5 h+ m i" E4 D6 P" O3 a3 n' }: I/ b
WScript.Quit();
) p2 \9 X' R7 {, s4 G& m1 y } ) _ I s4 F) ], ?
}
7 u7 h; S# N# ]. B % k4 }/ l6 D# J$ p {/ N
simple.StartSimulation(".Models.Frame.EventController"); , ?7 W [2 @/ s9 Z7 b d
' i' D; [2 W$ j+ C3 Vif (simple.IsSimulationRunning())
, G9 W. K' G' g& g: o; p/ m" |" L' @ WScript.Echo("Simulation is running!"); 1 \( s6 b/ r( u
: [/ ]# U; G' R2 {% w) U V
// Wait until simulation is finished # n7 J# ], s& f/ y4 j$ T0 b
while (!Finished) WScript.Sleep(2000); ; O, l5 y5 l. ^$ ^, c
6 l; l, B: x/ m: G4 k1 b# N: `
simple.CloseModel(); : x. K% L; n+ @! w! U
simple.Quit();
1 H* W: U# |$ h# E( N- S9 Z! NWScript.Quit();
6 m- _3 v+ {( m$ P' |8 U * d, Z# @+ {* X3 V# c* K7 J- D) j
# a) \0 t4 J' ?( M# R% d* Z: `function RemoteControl_SimulationFinished() : |9 c7 V3 e- i& b
{
& l& n7 G/ E/ R6 D1 P WScript.Echo("Simulation Finished!"); |