Example of a JScript
$ y* J6 s5 s s. [% Gvar vbOKCancel = 1; 8 p, g7 c8 b- W, | g' z
var vbCancel = 2;
z8 m$ S" _! c6 vvar vbInformation = 64;
$ F; L6 c: N- N2 A+ G8 tvar Finished=false; 9 ~0 M* X: [7 C0 v/ V
" W1 h2 v/ |3 G. }; i' V
var WSHShell = new ActiveXObject("WScript.Shell"); 2 s3 t' D/ U8 v( \5 x) r) x+ y5 }
. K" ], L) t+ \
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 i, X2 s7 A9 t- D 2 f1 ?) u+ N# `: o( U& Y
simple.SetLicenseType("Runtime");
5 B2 W" ^! Z8 g. Q ' z H* x5 G& ^7 J# d% w. `
try % R5 |* N1 m! E, F6 u
{
# ]! n4 [ m( |3 Z# p // Enter the path to a model file!
! M' } Z& R9 T, B e/ P; ` simple.LoadModel("C:\\Models\\Test.spp");
8 O; S/ m/ W' E# S5 A/ ?7 `" |}
1 v9 b/ ~: A( y [3 q# i% ~' U7 ccatch (e) 6 o6 e5 y+ S% M7 v
{ 4 [3 C P3 K* Z3 P. e; O7 C% M
WScript.Echo("Could not load Model!"); ; u: q( i, o2 k5 f) N4 T ?- [1 i
WScript.Quit(); ) [$ F, a4 N% U# `! k) z
}
d% }1 h9 M! b7 Y* ^6 y" I5 V . M0 {0 G) b0 Y( q7 S
try
' ~3 e$ E. j+ J, U) q: ^: g; ^/ a{
0 M5 B3 S4 H1 X7 ]" v3 K1 y. |+ |+ R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 n/ @) l& R& y0 x$ V, r4 R r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
1 n, Y# _& ?5 h3 W if (r == vbCancel) 2 z0 v+ p' g9 h' i4 d/ c( I
{
+ ?0 [& V1 j- x simple.CloseModel(); # w# B# `+ c, J+ x1 P
WScript.Quit(); : `, w& N% {/ o3 \4 \
} , Y0 ~9 d& ^. l$ d8 Y
} 9 O( B( T9 s2 h; D. ~+ ]4 i( A) [# e
6 B, p0 l. F! q+ zsimple.StartSimulation(".Models.Frame.EventController"); 6 N, P/ P f1 m3 J9 G6 y1 p; b) ?
. g; r0 M2 n2 Z. \0 Vif (simple.IsSimulationRunning()) 1 F9 N+ r; k% M2 k7 P7 ]
WScript.Echo("Simulation is running!"); 1 l/ b: |( w: t% R
% ?1 i% N( @7 s
// Wait until simulation is finished . {# s- }6 O$ `- |0 u0 U
while (!Finished) WScript.Sleep(2000);
% t: e) m( T; E' J H! l $ F/ |, s2 R9 @* J4 ]+ s
simple.CloseModel();
9 P! d2 S% u* V* Z; e2 @, @simple.Quit();
0 N W( V8 h4 P0 QWScript.Quit();
& G; ^: v% U+ v+ `: d+ y. A
* X" \& U9 B8 S" `) u
. T; s# S3 o1 _2 D' Tfunction RemoteControl_SimulationFinished() 6 b; p! B% ]" S* b9 `2 f
{
* _. P8 |$ ~* W/ Q& R C# x WScript.Echo("Simulation Finished!"); |