Example of a JScript
3 E- r: o; |# R2 D. {var vbOKCancel = 1;
+ P) e; \/ q( v2 N) h+ dvar vbCancel = 2;
1 ` L! n( p/ Kvar vbInformation = 64;
( t) z1 u V* n6 {2 A3 D( evar Finished=false; ; O) v1 ]5 O, M5 B. G8 K3 [+ C
9 e) K% O. `8 X D" [3 G
var WSHShell = new ActiveXObject("WScript.Shell"); 1 I+ Y, i. Q+ s E
& t8 w0 {* Q! h. W; d" @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) D" g$ u4 f2 T( ]5 o% [/ J t
2 B6 G! P! S0 Dsimple.SetLicenseType("Runtime"); 7 c5 n) u7 v: j# g7 Z
' s7 m0 W% g, k& D" Utry
+ V0 `" c: Q1 l8 |{ % c% q: ~# N7 |
// Enter the path to a model file! ) p& N7 [; M+ } I0 x0 {
simple.LoadModel("C:\\Models\\Test.spp");
' R7 C% F I/ R o6 A0 h} % y6 u' F" \, F, d F
catch (e) / @8 d. e: V; `% C# I* M
{ % t) ~" u n( o: x+ d+ x
WScript.Echo("Could not load Model!"); $ z0 j# K) f: D
WScript.Quit();
3 @$ Z1 x& o5 q2 V( m* G9 M} : t4 U! G- F8 ~0 P: n
s% x$ E( y$ r$ {try % S l& |' a5 P9 R7 u- y
{ / n2 H& [2 C9 d3 |" i& A2 t5 g( b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 \2 J3 K& H% _! E/ D3 S r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & L4 f8 C8 L' p. }2 l
if (r == vbCancel)
" P3 w( v( i3 B6 X {
1 M5 e7 p& E7 I, t5 o5 _# B simple.CloseModel();
0 E# e( f8 `7 L9 O WScript.Quit();
3 d( u2 l" c5 I: L+ n0 c }
5 |) K5 M% v7 X+ R& x} * L7 I2 e2 R0 p; b1 A) ?
. t, M' l' k4 d# ?$ zsimple.StartSimulation(".Models.Frame.EventController"); 9 P) y, z7 n6 n% M ]: s1 n: d
" ?. V: P- {1 b$ l( r
if (simple.IsSimulationRunning())
, m1 c% z/ q7 M1 k0 } WScript.Echo("Simulation is running!"); ' J( m5 i# Z. q
5 D, S3 W7 |6 C4 X// Wait until simulation is finished 6 F) B4 O. g( y% i }1 o3 r
while (!Finished) WScript.Sleep(2000); - T/ U+ d) m8 Z5 C
! p/ M# v4 O r2 F' Y: o2 a; a
simple.CloseModel();
0 A' z+ O9 s( p+ Dsimple.Quit(); , I" d# }/ f, |9 A- t+ p' d
WScript.Quit();
- Z8 @' j6 j1 x" B/ U : R" s- j% z& D4 Q8 u X! x# `
1 j0 O B) x* k4 W* c, Hfunction RemoteControl_SimulationFinished() 2 L4 {6 g4 C5 D
{ . ^% q( ?2 [6 \5 v
WScript.Echo("Simulation Finished!"); |