Example of a JScript / d$ a" v; P+ M8 B! ]9 x: S4 d. @
var vbOKCancel = 1; * q( t* M5 m9 @
var vbCancel = 2; 9 H3 P) H* h5 B; Y' C" X
var vbInformation = 64; # E# r# l5 u8 H) P& C" ]9 X3 v+ I _
var Finished=false;
7 S, G1 U" n0 s4 Z
3 |) J* }* P4 X7 H+ k, ?var WSHShell = new ActiveXObject("WScript.Shell"); : b) p" m& ?" |- i
`' x. P2 H9 v. L* D' Y; ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # o6 n0 {% `* w
5 ^1 `3 C& n" r
simple.SetLicenseType("Runtime");
: u( z1 C4 ^( y( Q, ^0 M
8 U6 i& t2 L* Btry
# U# Y' }$ W7 {2 X5 l+ R3 H{ & a- }+ l3 s# O2 [
// Enter the path to a model file! n/ ~& H+ U5 h- L: i) e1 ^. a
simple.LoadModel("C:\\Models\\Test.spp"); ( m% v6 ^8 `3 \* a t7 ]0 p
}
( w# J3 P* {; I, E, ocatch (e) ' [) [7 {. U- u; O
{ # c, W6 N o; c$ `
WScript.Echo("Could not load Model!"); 1 _, l+ y8 }+ d0 w
WScript.Quit(); % X7 f7 E+ B9 _( z% D! F
}
! r8 A* p& w+ X0 a3 ?2 h4 J# F % \: r" h" @% K& s* Z5 Y* s
try
. v, @6 Z' U( Y3 g; \{ 6 h7 U6 Y% i' l& T5 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , @' @! `% H w( ^: _4 t) M
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 T( a8 s. M3 ?( F1 a0 p if (r == vbCancel) . a2 U5 h# @* B5 A
{ , Z( q. S/ b8 Y3 `: j
simple.CloseModel(); 0 |& ], a+ x+ K$ H4 V5 t( \
WScript.Quit(); , ^7 u5 Y1 D0 f) Z/ P6 ~
} ; a% k. E, F1 X( ?
}
' X+ [8 R% f6 ]: q1 a W+ {! p. H " D* w7 [) w& `5 @
simple.StartSimulation(".Models.Frame.EventController");
+ Q8 e! o b: |- T$ O5 U & \ H7 O% ^4 w4 s. K1 c
if (simple.IsSimulationRunning()) / `" \ R/ v4 a; ?4 ~/ K) ]5 B
WScript.Echo("Simulation is running!"); 9 |+ o: `& D/ }- s
; j9 P5 S4 R- v/ p& [) @
// Wait until simulation is finished
/ }0 {( }5 I* bwhile (!Finished) WScript.Sleep(2000); # o4 ~& ^+ p6 @0 E: g1 M
4 ]5 f7 V& M/ c2 }& d: xsimple.CloseModel();
|. L; ]5 r( G1 O% w3 Q7 w, ^simple.Quit();
. X* S8 I- B( i% LWScript.Quit();
1 J) F9 F+ ~2 q
/ A" Z, K2 L8 h 3 S/ R% W; _6 \
function RemoteControl_SimulationFinished()
6 [7 h" Y6 @5 D" I d7 B( A{ ) N, Z; u0 i8 S% ]
WScript.Echo("Simulation Finished!"); |