Example of a JScript
6 K( d2 j8 C6 z" Yvar vbOKCancel = 1; 0 N# ]) [& [0 \# U9 B+ @
var vbCancel = 2; - U( `+ m* w Z2 b7 }* `
var vbInformation = 64;
6 x6 o( }. |) k6 e- _) wvar Finished=false;
6 w3 y' U/ j/ c/ f S % x1 ?* M+ w( Y, S; H6 e
var WSHShell = new ActiveXObject("WScript.Shell");
; i* r' W- E* ]; r8 g
+ a$ E! ~9 ~6 r. @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 [" S7 M A# s
$ f' a" z' V( ~: `) u
simple.SetLicenseType("Runtime"); _: E4 ^) e% }( l/ t- z- O
3 i2 ]& b0 D5 \; ]# w- itry 2 K; k5 Q$ B4 K+ X) X! j0 c
{ * ~, i, S5 N6 y9 i2 |
// Enter the path to a model file!
+ `6 H" y, T _" l0 ?# [' J simple.LoadModel("C:\\Models\\Test.spp");
) w* w+ P2 y0 J}
! l6 i' F- s/ Zcatch (e) 3 P( ], S' W% c8 W
{ 3 X% `% z; f4 c$ R: F
WScript.Echo("Could not load Model!"); , e$ f2 B& Q* l$ I; c. s( e
WScript.Quit(); 3 U# f) F( O8 n% v
} ! b; E0 j, ]% j; e" T- a) M
+ |+ e5 ~$ |+ \$ z" H3 C6 |try @1 T& E& x5 a h1 a/ a9 |
{ ( S2 W' w: q- }, W2 J( X
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
% c+ B; u! Q$ g9 v% R3 a7 b4 m" T r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 E9 d% u7 w" ~$ @" y3 D4 C
if (r == vbCancel)
1 T( r l" q4 J2 }0 U, m* s% l { ' w5 {: A- G. K6 ?9 R# z" |
simple.CloseModel();
5 c4 \/ X, e: d0 _4 B% i WScript.Quit();
# Z$ E0 Y- y0 ~2 m }
4 c- n3 G; ?0 s4 P( I- d} # c* H- ?0 S6 W/ n1 P3 d
( W+ K6 z Y, \+ A4 @$ msimple.StartSimulation(".Models.Frame.EventController"); . M) p. n5 P& x+ V% n! ]
( V$ I0 }& C" G; {3 w
if (simple.IsSimulationRunning())
+ ^2 K! n$ E8 e @2 j, k3 g: J/ ? WScript.Echo("Simulation is running!"); 1 b0 M! _, m: B! m! C5 w
$ f5 K5 N, \! v5 |7 q, W% x) J
// Wait until simulation is finished 3 S1 C* J2 l( m5 |5 b! h+ D# z ~
while (!Finished) WScript.Sleep(2000);
$ d8 A" K( d7 W
7 o' z$ A1 ?2 _1 C7 tsimple.CloseModel(); 3 j: L# X$ U& a! u
simple.Quit();
3 e- V' s- i6 `7 m9 x9 A) CWScript.Quit(); 9 G4 @2 n l) h: l; @! M
' m! l2 E6 q8 e6 ]& y
; [' P ?6 [+ X f6 F+ s! N- V$ ^function RemoteControl_SimulationFinished() p* e; x0 k1 x6 s B
{
* U9 a( g2 F# x* l WScript.Echo("Simulation Finished!"); |