Example of a JScript
) t% m4 M" V9 a+ ~var vbOKCancel = 1;
9 |; @) ^+ r1 y, E6 ?% G; r1 Wvar vbCancel = 2;
1 [6 G: O4 A+ ] _% U ~. ~3 z: Zvar vbInformation = 64; 1 X: I8 e w% r4 x. Z
var Finished=false; 4 ~0 e) I( T9 e# f6 a
% h0 p. q! ` C! C( p9 i6 n O1 K
var WSHShell = new ActiveXObject("WScript.Shell");
8 [4 l& K; z% a3 ]5 ~& t' l
1 B w. T r! ?# d2 S: O& qvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 }$ \3 j: V8 M& r- |
: V$ n* Y: b3 }# T" J1 g. P
simple.SetLicenseType("Runtime");
: U, W: F+ t1 B ( q1 Z4 d. q s; p" b% o4 Z" t% D6 c
try , k$ |* V, D$ c0 o
{
, A' N2 g ]1 ?* M // Enter the path to a model file! w8 ~, A _3 H9 H( m' j( ^
simple.LoadModel("C:\\Models\\Test.spp"); : k, `$ f$ d% l" w; k3 s$ u
}
$ {1 ~2 n* x4 Q. `" C+ ^+ bcatch (e)
0 X" |$ c( l* ^' } g( L{
2 W" Q4 ~# G% @, l& B# r5 ] WScript.Echo("Could not load Model!");
" G: j q2 s/ j7 R WScript.Quit();
( Z4 T7 j% }& c! a} J+ b& e3 Q7 P4 y, @' M
I9 q ?0 ~ t
try
h8 {# Q% U1 u# L6 A{ % Y+ S2 l1 a2 B, O6 [' o
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ( q1 Q: a: h$ |/ q6 K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; I7 m; |1 Y9 p+ ^# p% U6 c4 F4 ]
if (r == vbCancel) D& ?: ~/ V/ m, T% C1 p
{
5 l- U M+ d4 p4 q" E' \3 z simple.CloseModel(); 2 k6 ?' M6 m1 L7 o7 n7 G- Y
WScript.Quit(); # F: v9 a' R7 m+ n
} ; }5 ~, T5 f1 d3 B2 I
} " l S6 i+ U! K1 P) a; Z
' d. d0 y% O9 y; h( C9 _
simple.StartSimulation(".Models.Frame.EventController"); 7 H2 [% O- W- w7 ~
+ f4 S0 A6 c, q+ _
if (simple.IsSimulationRunning()) I, i r% \! G @. _5 Q% b+ B& r! b
WScript.Echo("Simulation is running!");
$ n9 w K1 H) c4 e7 Y
5 L% F3 Y1 {3 U: b// Wait until simulation is finished
1 Z) C4 E+ O+ Q9 [3 Vwhile (!Finished) WScript.Sleep(2000); , B; I& q/ Y2 s: K0 w/ U8 G
+ Z( C/ j8 v3 l$ X0 Gsimple.CloseModel();
) t% o1 L5 Q0 i3 j/ E5 T' fsimple.Quit();
6 q* ?5 U8 |) q! IWScript.Quit(); 6 J) Y3 O) a- w% H
: c ]3 r. p, o/ q* B7 I , E) Y) y" ?! n+ C! b1 Z9 i9 d$ n. u
function RemoteControl_SimulationFinished()
" U6 W# F/ Q: J! i{
: ~7 [2 q$ t# ^9 O2 s WScript.Echo("Simulation Finished!"); |