Example of a JScript
1 ` |" F+ q" }- m: n% Hvar vbOKCancel = 1;
! E5 \) W. _( }var vbCancel = 2; 8 O! |# q; }7 u6 h& x5 @% z7 W2 a& ]
var vbInformation = 64; 2 R/ E5 m3 X) _! N' v
var Finished=false;
! K' B" N4 s. X" x, @: `
- g( W$ J4 r0 e7 P- @" U- zvar WSHShell = new ActiveXObject("WScript.Shell");
" m7 [4 N' {7 a( ?- s: j: o* u" T
) J% C: L3 v m( m, I- @) ?2 |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ V$ ]2 j) V3 W# a5 |" q! @6 ~
4 f" o- W- I& bsimple.SetLicenseType("Runtime"); 6 y4 x5 \: ^7 E/ O( W& p2 u
! P& G" b# {# h: etry , E b9 _8 j4 |, I- C
{ * Y* c7 }& \" j7 w2 [5 D* f8 H1 E
// Enter the path to a model file! + m3 | J# d" E# x/ p! z& U
simple.LoadModel("C:\\Models\\Test.spp"); ) B& g2 Q7 Y; W( Y7 {7 F8 G0 u
} ) ]% a" _4 Z; u( u
catch (e)
w; s" `& t% n$ y! T3 q$ z3 O7 R{ 6 V! |6 G- ]2 b! r
WScript.Echo("Could not load Model!");
; Q/ N9 z5 h1 V }" \ WScript.Quit(); 5 u7 j) _% f( J! D! I0 o
} ) S6 x' ? D: P0 K t7 m4 p& _! e9 v
% E4 _$ b: c* e7 [8 C) J/ Q
try . g" g2 j! Z9 A# V' T$ U
{ , O- x$ X. I8 p, H
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' U8 Y0 G7 c# y5 k) L$ d# K- C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 z; ^2 ]+ N0 {7 w! h; e9 F1 ^
if (r == vbCancel)
& T3 H0 f2 s: _5 Z- H+ m, ^3 U- w+ P0 K { 2 Y2 G2 q- H$ v5 z
simple.CloseModel();
9 ^, i) s$ K- u& w# W/ S, u WScript.Quit();
9 n# u" f1 _ I. l }
7 z3 c' E( L0 }4 M1 [* @/ R, l}
1 T. X- w5 ]' L" n
! H! c, s& ]& d" f9 x; Z7 i& Lsimple.StartSimulation(".Models.Frame.EventController"); 7 e2 o' Q' ?% f4 P
5 @' z5 ?7 q9 T Y9 K" i; G9 z8 @# pif (simple.IsSimulationRunning())
2 O) W8 w+ V: A WScript.Echo("Simulation is running!"); 0 ^* P7 [8 m/ R
) t' P' a6 a5 Q: T& L- `1 t% @// Wait until simulation is finished % s% @: c/ |, n- L) |
while (!Finished) WScript.Sleep(2000); ! w' e! \2 O+ d9 r! Y$ F+ x
7 O, Z. {5 u" R9 J( U8 m; j5 l9 |3 Msimple.CloseModel(); + s' S) W* b* `* K1 A
simple.Quit();
# p7 l* _9 z1 EWScript.Quit(); , x, s# S3 r5 v! }8 c/ \9 R, f
, `4 f5 T9 o. i+ Y: i" x 4 D5 v! q7 |* @7 G' \
function RemoteControl_SimulationFinished() 5 E( f* y" ~" ]! ?8 G& `
{ . M. O$ k/ m3 _: `" q$ A, k9 v
WScript.Echo("Simulation Finished!"); |