Example of a JScript
+ W1 x" r0 K0 O! ?2 s9 s- {* b/ Xvar vbOKCancel = 1; 4 B# a1 C+ l( s. C% J
var vbCancel = 2;
1 D! o5 j: m+ S$ N8 t9 i0 v ^var vbInformation = 64;
, ~& A( B- Q* i# J) dvar Finished=false; : |& k: j) I# ?
; a0 j8 [6 Y6 J; }var WSHShell = new ActiveXObject("WScript.Shell");
/ t" ?2 {- @( O . V9 |7 n$ _% i: }5 y8 j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% N/ C9 x3 W- v" s% H # ^4 D( o4 ]1 |/ `
simple.SetLicenseType("Runtime"); ( Z. }8 r) `9 L6 c
: ]4 Z/ l! Q8 [5 f1 d$ ^: ttry
6 P8 {$ Z$ i2 L7 z% \+ y( q& D{ 6 J" L. R% Z; T2 k
// Enter the path to a model file! % X1 t7 T( ]8 y$ f
simple.LoadModel("C:\\Models\\Test.spp");
4 R5 W. }; U+ ~! \+ ]} & K' d& }, W0 f3 z
catch (e) ( o: r% p( a+ s7 m% s |
{
: k7 p3 i, W3 r! u$ y O" s/ H9 P9 C WScript.Echo("Could not load Model!"); " r: O7 K3 J' q, Z6 r
WScript.Quit();
8 f4 u* {9 L F6 L1 @& Y2 i} ; W5 n" R# y; G% U+ P
9 b6 m7 L/ s& _+ V$ g1 c: ytry
2 n, W8 z/ G9 G, I7 y{ ; W' _0 M. k) d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 D* o X: O; m% S
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 F* H2 A6 b9 i2 e2 d! Z if (r == vbCancel)
. h; K+ D, J% N {
2 a( m7 h1 |5 V& I! m simple.CloseModel();
: ] p0 m+ n% C7 Z WScript.Quit();
( y0 t Y/ ~. d: c }
- p- i" _$ j r1 Q! F% h- [}
: u' p# S G' U8 y
! q9 ~. _4 W; \0 V5 o4 lsimple.StartSimulation(".Models.Frame.EventController");
, A4 S$ {% Q7 B3 A, p 8 L: B4 o$ Q7 [7 X$ X: B/ x4 p; m5 n
if (simple.IsSimulationRunning()) ; ]5 k/ U% N8 L U+ V
WScript.Echo("Simulation is running!");
& R( [# X/ d2 {0 j9 \8 H: ] 3 ?- ~& Z( t c D* C
// Wait until simulation is finished
# K8 \; l* T& @- C3 Z8 I% ^. N6 ~while (!Finished) WScript.Sleep(2000);
3 @) i; R, a2 F' F
& a0 q. S! }( d5 Z; k3 n; ]simple.CloseModel(); . ]# [7 @" P6 D( R. c( x
simple.Quit();
) e0 x7 E s' f; e2 ~; ]) k2 FWScript.Quit();
8 ^8 W1 t, ]8 y9 I8 Z
2 p. y7 Q; }. |5 [1 v
0 v' \; F2 h" T& [2 kfunction RemoteControl_SimulationFinished() 1 {7 _/ T* [5 g4 s
{ 5 C! o/ a0 P# d
WScript.Echo("Simulation Finished!"); |