Example of a JScript ) M0 v! h/ F8 t% f' j* K3 M P
var vbOKCancel = 1;
* F( T+ D- c/ V# T' T& mvar vbCancel = 2;
4 [ \' w$ } y4 D N( |var vbInformation = 64;
' W+ v4 C6 ]5 i5 E0 wvar Finished=false;
4 v/ t5 [% o p: y# P+ k! s; t
' B* f" ?( g; I3 T' Nvar WSHShell = new ActiveXObject("WScript.Shell"); 5 P3 D% s, \ t4 Y0 y- n; B
8 d2 U5 v: Q$ e
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * Y& S- R1 Y, {' Q. [/ Y. R0 q
5 u$ b# z4 l$ ?8 G6 _6 B* t: m2 rsimple.SetLicenseType("Runtime");
1 t& {, k& v4 t8 j. |; Q' u8 O' } 6 x1 B( I3 s# _! i+ k: Q
try , |. \; f7 @1 @3 J% g% i
{ 5 v2 }& ?+ |9 t) X3 R0 p
// Enter the path to a model file! 1 ^" p# h1 X' W7 T( l9 [, `8 i3 ~
simple.LoadModel("C:\\Models\\Test.spp");
+ S/ Y8 x6 {: d7 [* u' M5 A} 7 s! U( R3 ~, d
catch (e)
& w2 q+ v" O" L+ X{
, g) x- B! V( M9 W& ?! B6 T WScript.Echo("Could not load Model!"); 9 V% d1 T3 z ^. d* {1 O0 E
WScript.Quit(); ( |$ Z& K7 ^8 ~9 q! r
} 6 S- t! W, D* J& ^# L0 t) _
" c8 C0 F1 v: z0 m8 ?) i
try ! [9 p: Q6 h" T, h: o# q! O$ f
{ , d2 c/ ], q2 m5 B
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / p W' u5 J! _ P. Q: E
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , U: H/ F0 F9 B3 C* R `/ H: d
if (r == vbCancel) ! t; G5 c' h y0 C: _
{
2 r/ P7 P8 ~0 G1 o simple.CloseModel(); # B3 O) t7 w/ H5 q7 P
WScript.Quit();
. U$ B; u7 x: w } b7 n+ ]* T) f4 O/ f. @: C
}
6 w3 }. o3 N6 { + q8 `+ M3 o5 ~, g
simple.StartSimulation(".Models.Frame.EventController"); ) Q' I ~' \9 w! E/ a
& r; U* L( Y: @0 {; `1 ^3 a! f
if (simple.IsSimulationRunning())
! y6 U8 ]! X! M: t8 A( `0 o& x WScript.Echo("Simulation is running!"); & u+ F) X% c" f6 J
! I( }1 J/ W. T8 W8 O// Wait until simulation is finished * u7 H" v. ~$ W
while (!Finished) WScript.Sleep(2000);
2 \2 ^. }0 ~$ Z. t9 n2 x 4 w' X U- g: w6 z3 Q0 [. ]
simple.CloseModel(); 2 e8 `. I3 f! U
simple.Quit(); 6 R" [! s7 C( k( M: ^9 B
WScript.Quit();
8 ^' J* d- v, F' b _. }$ q0 \
6 ~$ {- _' `7 L1 z, q2 c6 p ! g/ I( b+ M K, p# M& x2 I
function RemoteControl_SimulationFinished() 5 ], S. ~3 i. c( o7 W( R
{
3 ^! B" K b; M! Z WScript.Echo("Simulation Finished!"); |