Example of a JScript
7 h4 J9 P" I% p. Y! h8 x6 Q! m7 Avar vbOKCancel = 1; R& W2 C, G, T: I
var vbCancel = 2; * m8 a; ^: C1 N$ p3 @
var vbInformation = 64;
: h4 x: y$ n7 ?" e! ^var Finished=false;
: {! s+ e. A( N
+ j# ^( {9 {- v1 }: u; ^var WSHShell = new ActiveXObject("WScript.Shell");
% a2 e) v# x. X# C: `9 u . \& K, p" \- f: ~8 \! ^
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# x, h7 J7 Z' l$ m) W7 c. K ( e1 K/ D/ f5 |& N- u
simple.SetLicenseType("Runtime"); 1 k) c3 a6 a" `$ A( J0 V9 r* j
$ h& P' \& y- n' E" K
try
9 J% K+ V Z& z4 v3 N! L; y{
- w4 @5 [7 h2 B" R) w& j* r // Enter the path to a model file!
x. n% ]# t3 Z7 q0 W$ \ simple.LoadModel("C:\\Models\\Test.spp");
t3 G9 \, H6 R) K1 v6 A}
* E( v3 m$ q2 R% Q0 K5 acatch (e) 1 @9 J) C# a& w( v
{
, q0 e: T3 n, d- `* e0 ] WScript.Echo("Could not load Model!"); 8 q6 o0 c2 y3 G! J
WScript.Quit(); 3 o1 P6 |* }* w9 ^1 g+ \
} ( }5 [0 G8 S* e
8 A7 A) k. k5 Mtry ) o2 T+ _2 K- d4 I/ F! s# I' {* C
{ 2 }; }" B4 K! \$ C; v1 ~+ m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
Z1 i2 N4 g) u4 F, u. N9 h; j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' j& V8 _5 @( x9 l: X8 ]9 @ if (r == vbCancel)
' U) y' A9 d9 _, B. G {
0 x' H5 P* O) c( m! Q: j simple.CloseModel();
: L _. j, |8 E) j& u8 k WScript.Quit();
1 K. w; g8 A) _0 ?4 ^% M }
- t: P9 U" E7 S+ T9 l6 w4 j3 O0 k} ! z! h3 z% W- y5 d4 |& B* Y9 u* c
' F, r/ @: |. {/ |$ Q/ L) x5 zsimple.StartSimulation(".Models.Frame.EventController");
. K8 [7 V8 G; S0 \5 v0 k! j * n% ^5 t4 H5 x) ^3 e- q2 |
if (simple.IsSimulationRunning()) 2 V3 A2 a8 n( C+ [
WScript.Echo("Simulation is running!"); : J! }" U, ]! Y2 V. E
8 Q0 M o1 V" V6 A# N5 L// Wait until simulation is finished
! K4 e) x+ k9 I1 Jwhile (!Finished) WScript.Sleep(2000);
0 |+ d8 p H' A' l. c
$ b% I1 R b+ a/ \- b% esimple.CloseModel(); * l( a: j% q% n
simple.Quit(); , T, Y1 N C0 P
WScript.Quit();
5 r7 i$ |- p4 t' y$ S8 x 1 A3 G$ z, g" M# @0 Z, A$ |
' H. O6 w' n" D) {function RemoteControl_SimulationFinished()
3 ?, t. z8 b- I{
5 E0 w4 w5 F( N* e5 I5 R WScript.Echo("Simulation Finished!"); |