Example of a JScript 8 _6 i4 I' [( t1 i" f
var vbOKCancel = 1;
+ n, p, \" g# E- I% v) Zvar vbCancel = 2; ; c5 s% F% R' p9 [9 G! V( W
var vbInformation = 64; 7 I+ t! U7 r* i& u& L: @
var Finished=false; : K6 b5 c4 \' |: D
+ _, h1 K2 n m8 X. p# l
var WSHShell = new ActiveXObject("WScript.Shell");
4 v. x6 S T, }* r& O0 l ! [- H! \; I" d B
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# X! I+ F! g" N; Y
1 n- t4 m. T1 g; P/ c0 \3 Bsimple.SetLicenseType("Runtime"); @' g4 d5 y5 u9 l- f9 V
% b. f- O Q" X k/ e
try
# U6 @$ e0 L) ^ [1 W{ 9 X0 B" N% {) u! U6 Z8 o- S0 F
// Enter the path to a model file!
1 b7 L$ L9 B; y ~8 S simple.LoadModel("C:\\Models\\Test.spp");
0 }% }( e# m4 v4 l' Q X} & F. M& {3 s9 p9 D
catch (e) ) p" [1 l6 A4 X' h5 q/ p) e/ R3 M4 e
{
0 Q5 `$ \7 P; y9 ~+ o WScript.Echo("Could not load Model!"); 1 z4 k% Z8 {+ x5 T/ j/ N* |
WScript.Quit();
# A5 X" h! y/ R$ S0 G( u W} + _. M5 n& _& i F6 C
5 A6 Z% \* T: S4 W5 r$ x' C9 V5 O
try ) R/ E" }9 H% j. l/ x* i5 V
{ " e7 ?) z+ g7 X$ R
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # ?- j, a0 C% C1 }
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 M Q' D3 r" V* W4 `" m' X. }$ g8 G
if (r == vbCancel)
9 \4 t6 e% L8 v# x( Q2 x8 ~ { 5 Q8 c+ W" Y: K" H! w7 J' _% q
simple.CloseModel();
' y5 j9 k: q$ ~3 ? WScript.Quit(); # n [. H8 P; f$ A
} + G* p+ y* g9 N% R2 E4 g" d
}
7 Z* k: p X, y0 \1 _
7 J: \! X2 \5 L" m" f+ Ysimple.StartSimulation(".Models.Frame.EventController");
% R) F( _2 T6 c7 ]3 K3 b: ?. i5 O L
: i0 }6 U8 z7 J& v- Tif (simple.IsSimulationRunning())
. d4 r$ Y# N9 x( m$ }+ k- | WScript.Echo("Simulation is running!"); 5 U4 n8 K; z. D& ^9 {! D
2 j# r% V! t: H* |' ^& h4 P
// Wait until simulation is finished
( _5 y! P/ y; H3 K9 ^" v1 fwhile (!Finished) WScript.Sleep(2000);
' `3 ^ c' Q- Q, |( Y $ ]1 y, D; i4 e+ t6 ~5 S" S
simple.CloseModel(); - U5 N" B; }6 _) C% `. w
simple.Quit();
& @; l/ W, v) g# r& U+ \8 L* ?3 JWScript.Quit();
9 K0 r+ k: `7 l I ! Y) |+ C' }% z0 s" h
5 [" f5 t. E, ]- B$ G# O8 w9 Lfunction RemoteControl_SimulationFinished()
% F2 c4 T2 J, c& q" p9 g) k{
) N7 d4 S6 U* a, x WScript.Echo("Simulation Finished!"); |