Example of a JScript
" ]+ R3 ^9 d/ d- b( pvar vbOKCancel = 1;
, ? M5 E, v" q/ y3 a7 a* _var vbCancel = 2; + t- R+ T6 f: r6 s9 L0 V: n& X! D
var vbInformation = 64; " G6 d* S6 o# c2 E8 W" W. Q
var Finished=false; , {! D8 @3 s1 a+ r; S
: h; y9 x+ d0 R( ] avar WSHShell = new ActiveXObject("WScript.Shell"); 3 c" x1 H2 j/ T: x: |# n
1 s; l: Q. [3 o3 s* Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* p+ H: N9 H0 E' B& i
! W6 k( ^; ^. e4 [( U- Bsimple.SetLicenseType("Runtime"); 8 J4 O& s' E, N% @
5 X7 w5 S( y3 G- z9 c3 O% x
try / y# ?% f4 e. x1 I" ?/ z' K' @7 |: n
{ 5 q. z d K. b; M* E
// Enter the path to a model file! 0 F, U a" {% b. B& l y
simple.LoadModel("C:\\Models\\Test.spp");
/ d& a6 i( X$ u- c1 X} }5 X& y7 {5 h* ~! Q2 o
catch (e) 9 |4 v7 _& }0 J5 \) x) C4 T! e
{
, _. I) L2 T4 M! |: F WScript.Echo("Could not load Model!"); 0 J4 G4 z0 Z# M e; E* Q
WScript.Quit(); - l( l. E6 X) `
} 1 n' i, h2 a; M9 I3 q9 C1 w
& \& }* a) c5 r% q9 C: a! ttry 6 H* k/ I* [9 F% n$ Y2 X0 i J
{ $ o q. p# I% o6 }- W3 ?' p% T
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 |& D! x8 E; n4 b, H% d$ J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 q7 z1 ]; ^* _ if (r == vbCancel) & e6 _. h, Z' X1 x
{ 2 C3 T3 Z# v$ o+ f4 u
simple.CloseModel();
* W" {6 p& u) O6 s& x. K& v WScript.Quit();
* t) y) R" t( Z7 Q4 @# e! Z } D7 L2 d8 [) A
}
; s9 U; X$ T& F, C& K \
X: N& H( x$ e- y% v" R$ J/ [simple.StartSimulation(".Models.Frame.EventController"); ( G8 z* R k4 D# y
: M& c5 |# p# v4 P& Z
if (simple.IsSimulationRunning()) 2 m7 f; u4 T7 m9 v7 _* o
WScript.Echo("Simulation is running!"); % f9 X* H* U# P
8 T9 {# S h# B8 d- t// Wait until simulation is finished 4 I; }1 {) R# J& K% g* }
while (!Finished) WScript.Sleep(2000);
, h$ A0 r. P; B
9 R& q$ s) V: F; F# Rsimple.CloseModel();
4 @, ~$ z' H W# n Ksimple.Quit();
( H1 \( Y) W; A+ b9 j8 P/ NWScript.Quit(); 4 Y4 u" q1 y8 p T9 ?
' T- x6 k6 y$ @4 E7 B5 s) Y2 |
4 c% H8 h; T( U; l6 c" @& H, |function RemoteControl_SimulationFinished()
4 p; z/ B1 ~4 O8 ]! _( i{
5 \0 y9 d; w6 g1 p1 \# q/ E WScript.Echo("Simulation Finished!"); |