Example of a JScript
& K2 K: ^+ K* e, o% w5 e% Ivar vbOKCancel = 1;
; J/ u) l8 {& B _- yvar vbCancel = 2; 8 Z2 @3 U& s3 B7 j# s) J9 C* p% o! q
var vbInformation = 64;
! ^" g- S/ G. }' gvar Finished=false; / z, E! ~3 z% e; O
# L3 p( n% C* I
var WSHShell = new ActiveXObject("WScript.Shell"); B7 X- o# w2 Y! c
- h% z2 U6 N9 g4 s+ \var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: `: j* G# ]/ M5 I ) E4 t( `' i3 }' P. ?' z' Q
simple.SetLicenseType("Runtime"); ! H5 [7 a0 e' N, N; s4 g( M
3 q# e; R1 O2 W1 g# q; B
try 6 |, q3 T" P3 z+ o, \0 R
{
9 f/ R- ? R, a2 G# o. m# G5 J // Enter the path to a model file! . C5 S% o3 I( o) @9 l4 X, K$ m
simple.LoadModel("C:\\Models\\Test.spp");
* B4 K* h4 P9 S- X5 V}
! L) ~0 |8 a% ^ x+ Ncatch (e)
8 l0 B, ^8 ]8 M0 v{ 2 i2 U" p* X" p# ?
WScript.Echo("Could not load Model!");
/ ]: }' M& F3 s7 ~ WScript.Quit(); , {- N- f4 u" B; o
} V8 C/ e% d" q- v9 f, ], Y* G
, f& }- q8 L% A2 q n# R( L Ytry 4 v8 m* a! l; Q' C7 h& h
{ 3 ]+ p, P# y) p9 x0 \- F3 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , O- m2 t* b1 p6 N# N( H7 n- D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 U- S; B B5 N, ^% U$ _ if (r == vbCancel) ! v& G4 K5 e M. p! t4 u
{
- s& M% `1 q8 v- `/ x( s5 _ simple.CloseModel(); - E! B" G8 `- ?' r
WScript.Quit(); 2 `; U# P. M0 Q4 q9 f
}
2 V. ?& l6 @+ g: R} 3 O+ ]* l' s* w, J- O* w
& i, K, ]7 r- G3 d0 h1 Y" p' A
simple.StartSimulation(".Models.Frame.EventController"); $ {) {! |6 @; H$ b6 p
& o. c3 g0 J; h7 l7 Lif (simple.IsSimulationRunning()) 0 D9 q# @) ^2 ]! u! y2 ^$ X4 R, s! Y
WScript.Echo("Simulation is running!");
4 ]% w, T" g0 M2 c x; w* v4 v+ V& v$ z8 ]' P2 A
// Wait until simulation is finished # B" x l8 i/ b1 p8 m, G, o; ~+ ^
while (!Finished) WScript.Sleep(2000);
0 [+ @( V! j: G/ O
0 S/ W! X, W0 t \% Ksimple.CloseModel();
4 ~$ A- B' Y% a4 s; Vsimple.Quit();
2 K" _8 b# v3 R# G8 H4 s/ Q: sWScript.Quit(); 3 I; i8 M5 y8 X- A) ^9 g
+ l, ]) u1 i0 s1 w( Y. I9 h
1 ]$ K' z. u7 l5 l/ U! V/ j9 C
function RemoteControl_SimulationFinished() & G3 T, m* Q) E
{ - Z( Y4 ~; G* W1 B, @
WScript.Echo("Simulation Finished!"); |