Example of a JScript
; o2 k3 l/ M; U' J4 W Y8 Jvar vbOKCancel = 1; ; Q& p! f2 U9 g
var vbCancel = 2; * ^" r. F8 V) ?7 A" y# A6 q
var vbInformation = 64;
: c5 T* Y4 q; ]- l/ f5 mvar Finished=false;
B$ q" x& W" Z7 O9 _9 a; A+ t G3 D( q* T7 ?2 ^' F8 I' `
var WSHShell = new ActiveXObject("WScript.Shell");
" f+ {8 d! Y8 _; z# a# e% J
/ h$ o( _% G- Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * P: |0 J' o9 }. J
0 x1 @) }1 b) ]" ^$ ?simple.SetLicenseType("Runtime"); 3 a! w. X$ w/ @7 W f( X
& ]) ^9 U. M6 Btry
) D" p2 U$ _1 r% f1 X+ H0 @0 x* ~{ 8 I* d; v' h$ s$ }5 ~. `: [
// Enter the path to a model file! 9 T; o7 o) `6 U1 z& t* }# B
simple.LoadModel("C:\\Models\\Test.spp");
. H, i9 o% A" |9 x7 I} , a7 J u* p5 u
catch (e)
- n' l2 m/ t1 C, S: d2 ^{ ( a, D& x, V/ w8 k9 B
WScript.Echo("Could not load Model!"); : K) U- u% |% R% ?6 E$ M9 l
WScript.Quit(); # s4 k/ L2 p2 v
} . c. Q2 z3 P9 }
7 l" J3 P! v5 w& k* x* }
try - e& T* m, K; ]! Q: A6 [+ @
{
. q1 b K/ @, J8 T1 Y7 ~ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, u( H" z) L3 o+ d7 q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % C/ Y* ~ j6 ~1 S; K# U/ x
if (r == vbCancel) ' o3 i% @6 S8 ]; ?* q4 c& }
{ 6 Y1 q8 o, P1 o, B
simple.CloseModel();
2 w# V5 j7 C1 g! K5 s, N; o$ X WScript.Quit(); % {! X" U4 Z! s- q; r9 Z& Y
}
" C9 m- _# j0 C5 h}
1 b9 U* n5 \4 ~+ `. y, h / x2 W4 ~ W8 T& L3 A0 q
simple.StartSimulation(".Models.Frame.EventController");
" D+ B6 w. V6 n# G! Q 9 [. {$ h3 B2 u7 q9 s7 ^- q1 F
if (simple.IsSimulationRunning())
* J) w/ f! o! i q m WScript.Echo("Simulation is running!");
: K; Z6 b* \: |7 o! O# M0 w - B' y$ H$ H4 f! `5 B/ |& y
// Wait until simulation is finished
* f6 F6 j" t8 C. B' W& b, Gwhile (!Finished) WScript.Sleep(2000);
9 B0 w# L0 A9 Q
0 |/ c( i6 `( i$ f& Esimple.CloseModel();
$ g: r( n* L& F+ @: Vsimple.Quit();
- ]0 u1 o( A2 M- f! yWScript.Quit(); & i3 |9 u- `; J5 I
& u" ?/ b/ }& r3 ^( P. X
) n+ D7 \( @( y) Cfunction RemoteControl_SimulationFinished() , L5 d' C: e( t
{ ( @: ]3 k, c0 J' u
WScript.Echo("Simulation Finished!"); |