Example of a JScript
# A% K, O! [+ q/ H, A% u# x( |' ^var vbOKCancel = 1; 7 r# Z, B# O* [# t! b3 Z- R
var vbCancel = 2; 2 A5 G* ~( @5 E6 W+ O& R+ @' ]
var vbInformation = 64; , ^. w# p6 L1 u& y- w
var Finished=false;
$ I# ~8 Z4 i+ A& b4 y : j5 q& p! o( c- T I. ~
var WSHShell = new ActiveXObject("WScript.Shell");
, Q" b5 m/ I+ n/ {7 w, c# o* \
8 {2 A" C. P- w7 ^. |% n. m svar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! o" D4 [/ i2 e. v, j2 m3 T 0 n+ Y: l/ ~7 K, f6 |8 W% w- d
simple.SetLicenseType("Runtime"); ) s! N/ E6 H! J: M
0 |. i" D1 \" {/ ^
try ( p( J( A# I! s" l, g# p4 P
{ * C0 n' z( e% r% Q4 f
// Enter the path to a model file!
5 v' K0 Q$ {1 b simple.LoadModel("C:\\Models\\Test.spp");
, J( r" W: j I. t. l}
6 |, s7 {( A7 M$ Pcatch (e) 1 v6 C/ d' P) d8 z" x! f) Z
{ * F: A5 K" L2 }; g0 q
WScript.Echo("Could not load Model!");
, K7 b- H% c, Q9 R WScript.Quit();
( u( a1 q$ ~0 J8 }3 h* h} ' {5 E, f5 h3 z! L& h. e( O9 t
& F8 w& Y+ B" Q' z3 {7 R* o/ }try
6 U% U3 k1 n2 R{
* S& q; }5 J v5 f0 s simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { & P! V- V) o! x# g% K6 q& c
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & x3 S5 p( X! U, S1 ]% W1 O
if (r == vbCancel)
" i' w! [1 u" @9 w { ) V. k& G, b* ~% _2 M
simple.CloseModel();
* R8 i# }8 P& ?9 n# p4 i7 G9 p1 t WScript.Quit();
" R$ }! H; T4 z; }; W0 n* v' M9 q }
X! H }0 _9 n/ \ t} * T6 ], L2 z( Z9 ~( q
3 L/ b) n' G1 C& a+ e4 t! U" jsimple.StartSimulation(".Models.Frame.EventController");
7 f5 O) q/ y0 ?, W1 @- M 5 I5 R* I8 ^4 t' y5 c F3 Y
if (simple.IsSimulationRunning()) * h# ^' z* K9 p, Y* Z
WScript.Echo("Simulation is running!"); 5 `5 P' J, f, \4 ]
: r- o/ r1 |+ F/ q$ Q# K// Wait until simulation is finished " n K7 M2 E" ~, i
while (!Finished) WScript.Sleep(2000);
c0 q9 k L* i& j1 O
% H2 R R) G$ b, lsimple.CloseModel(); 5 E/ d* @6 S& u l8 a1 x- t
simple.Quit();
3 O2 V% T5 g9 B+ x9 F* |$ |WScript.Quit();
6 K6 ~. ~1 {0 d) F" L& x" A
% O D7 r- W3 T6 e7 v( b ^7 ]0 g7 B! D3 L3 |' k+ |
function RemoteControl_SimulationFinished()
. l3 D( @5 |$ T! H{
% W3 x7 t. J* h/ m% s, W WScript.Echo("Simulation Finished!"); |