Example of a JScript
$ y; e# f2 ~/ f) l7 P5 I1 {var vbOKCancel = 1; ; a6 n- @" y& v6 K
var vbCancel = 2;
+ q) o& s/ A7 u- xvar vbInformation = 64; 6 n3 }) k6 i! h) k
var Finished=false; 0 }1 e f0 t; x9 x3 B* C1 R6 _
/ {. L: g( p+ y0 L+ P( V. X: j" bvar WSHShell = new ActiveXObject("WScript.Shell"); % V m) U8 q4 T, G5 j
, _% z- y! \# y, L$ ?
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
q3 l3 ]& U9 x# y5 b , E* ~) V7 [% v) N% h1 r% j1 {
simple.SetLicenseType("Runtime"); ! P: f4 A6 P# k" ?
0 N1 B1 _& _ V( J' \7 itry
/ F* Z, k# }' t& m% ]{ % E- u# [' f Q2 ~+ K5 U2 M& @
// Enter the path to a model file! . y) ~* d0 I4 P" C- ` \" f: O- J
simple.LoadModel("C:\\Models\\Test.spp"); 7 F' Q2 b- h9 b7 C& P- l+ r9 A
} 2 C s; `5 m$ D0 a$ B# W4 f
catch (e)
y+ U' {2 r! C# m9 p; D' h{
' P) {1 h4 F. w, U0 O& W# U WScript.Echo("Could not load Model!");
6 N' V$ Y2 O# e( ?2 K) B2 n WScript.Quit(); ) |, Y6 H8 h# ?
}
& L% Y0 I$ O2 ^+ x
) { I% s. U# I8 F) Q6 e" Ntry 1 K$ L; \( m9 D$ ]0 v
{
" r; T0 b2 f" q, s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / P& A3 c0 _$ G0 Q' s- B
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! g; y- a' ?. D. y
if (r == vbCancel)
u- R6 n4 X- h1 U {
4 |/ \8 B$ R/ P a* n5 R& k simple.CloseModel(); ; ~" m, O3 i2 t' N" c% `
WScript.Quit();
8 `" e' k G0 K. ]( y5 b } 8 k6 A; ~0 Y% q$ S
}
5 S4 J) ], ?! b5 H
4 Z9 ^3 k P6 v- e2 Rsimple.StartSimulation(".Models.Frame.EventController"); + l# N# j1 X+ c1 M7 f
0 Q& Q% W5 ~4 i) Oif (simple.IsSimulationRunning()) 3 o, i% r! i) l- W1 o( J9 a
WScript.Echo("Simulation is running!");
- \, l# b* |0 r$ O
* y4 Z. Y, A9 ^// Wait until simulation is finished ( _/ C6 K+ t+ c+ M
while (!Finished) WScript.Sleep(2000);
# \; h7 C6 K( f' k& t! h' P " e$ U& z- D, y0 n
simple.CloseModel();
0 Y3 ]$ H8 B' R) k7 B# B/ }9 X; ]% ?2 Msimple.Quit();
- l+ y3 v# @! dWScript.Quit(); ' }3 r) v+ O3 D8 u3 }6 k9 A& {
- `. x1 Q$ h! D5 @9 K9 D : ]5 \8 O! v8 ?- T! D$ R8 e
function RemoteControl_SimulationFinished() $ l# c. x8 J2 `1 L4 x/ ~/ w. z, p
{
& ?4 Q) T8 P* o WScript.Echo("Simulation Finished!"); |