Example of a JScript : c- w1 R$ g+ c0 F
var vbOKCancel = 1;
; d* ?# w( \9 M" w* mvar vbCancel = 2; 3 ?- s- |: j* R! t/ ]7 \! }+ U- \
var vbInformation = 64; 9 R; M$ z9 w9 E6 |
var Finished=false;
! ?# t* U% {% {6 N5 h
3 Z8 [. }8 z) C A) f- n5 @8 mvar WSHShell = new ActiveXObject("WScript.Shell"); }4 f- @( d. a0 A+ ~. |* y7 x$ L
: k* u! @/ h8 T2 b5 m6 O/ X6 r/ H. b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 S; `! M5 A: W# y4 S 4 E& E1 J& D: Z, X; I( ]0 I
simple.SetLicenseType("Runtime");
; } G3 l) a! R" _+ o, z
: g+ U+ }% s' [7 b2 ]( Y1 dtry , k, p& x- {; [- A4 c
{ , x: |; E4 [; f. u) B/ [6 H; T
// Enter the path to a model file!
! v* Q( d$ V- n$ d; {+ V | y' \( w8 a simple.LoadModel("C:\\Models\\Test.spp"); & D# |' @8 g1 Y: p
} * L+ R" `; p+ w# f+ g+ H( J
catch (e) ; C1 \2 o, p0 u
{ 9 \$ z7 U C; J( {4 V9 z
WScript.Echo("Could not load Model!"); - t Y- ^. q6 O) M
WScript.Quit();
5 k/ P# z, r% L& F" R/ V* L! D} 5 H4 {0 c3 ], d" s
2 T6 W M! n& N- q0 d) _- f
try 9 `) C F$ h# q) K9 g; @
{ 8 i8 O) ^( E2 b( t/ g
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , d. ^1 c( @6 L, \
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* G$ d% V9 g# l# u$ o; l! J if (r == vbCancel) . T4 n$ z, t" |( h$ x4 \
{
! J( \7 ]7 t$ Z' X( s simple.CloseModel(); + v/ Q5 @ [+ z3 g. U
WScript.Quit();
) c% O9 f1 c: B) T2 T7 a" \ }
" r4 ?' i" M; P7 y& @+ X+ {) T3 G r} , S; B2 m; I9 v! n5 J4 s
% X1 F! L) R, H
simple.StartSimulation(".Models.Frame.EventController");
8 I7 e: M& S! e/ a8 f % ^- ^* N8 l6 x7 q
if (simple.IsSimulationRunning())
7 ]+ o. C5 `# x, Y+ L' S5 W WScript.Echo("Simulation is running!");
5 |( |. p! X) Z4 h: l# p' ~( G9 u
P$ C* D: d; g; D$ [+ D+ R// Wait until simulation is finished * a0 [2 D4 T1 k* z% ?0 I
while (!Finished) WScript.Sleep(2000);
- ~$ N: _- P* p: F9 v$ V
$ Y% c0 D4 X5 G& K3 f" L* X2 j, fsimple.CloseModel();
4 n3 }& T0 M6 l, ksimple.Quit();
) v0 }" U3 w2 t, I0 q5 U) eWScript.Quit();
0 e8 m! `) @ N; v4 p
/ I5 ^) _8 z+ a4 n
3 V$ b' W* L: s9 Ofunction RemoteControl_SimulationFinished()
2 m( h" q! x2 D& {6 W{ - U; [: z2 {; B' E2 O$ B$ A7 \
WScript.Echo("Simulation Finished!"); |