Example of a JScript ! i. y9 d/ s7 C! I4 A$ f
var vbOKCancel = 1; 3 s& ^- b3 |5 f9 I) ]7 s
var vbCancel = 2;
6 Z9 Q; v2 _( G! b' Evar vbInformation = 64;
" \, k" y, ]# R- s. Y3 hvar Finished=false;
1 D7 ~& [( K" f4 o& j- L9 R
! v& ]8 u& j9 M$ J! C" qvar WSHShell = new ActiveXObject("WScript.Shell");
4 D, u9 x2 i0 F! D# S
8 O8 C: h$ ]4 P+ `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - Z, W/ h( I" T" f
t1 L, `! X3 s& J9 i; _simple.SetLicenseType("Runtime");
0 }% Q. D8 S6 Z9 J& l( A 0 L& I$ A L2 w2 d s2 m
try
6 ]3 v2 e' C. a* Y1 I3 m{ : B+ @9 Q! G, K$ d- I3 S/ P5 R
// Enter the path to a model file! $ S0 }+ e3 ~+ u' V5 g& N
simple.LoadModel("C:\\Models\\Test.spp"); 2 M% \, z1 Q/ E+ n, d
} 6 D2 v+ W7 A7 n; W/ W% G0 \
catch (e) 5 q: Z4 E; g+ ]' G$ \# {
{
2 k5 [% Q2 ?- B" t+ m$ } WScript.Echo("Could not load Model!");
4 C6 \* V+ S6 u! A( C WScript.Quit();
/ F; ]) b6 Z" \) ?# t# ?}
3 s/ o- e6 S. |. m' D) F" ~+ k) B
' g- {* }9 t0 q& z6 ftry
, ]5 }6 _+ Z) B. ~{
" i! g$ A T: L. z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( X7 d2 p; z- |. [" K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) _- Y$ @, L0 M! Y( Y4 P3 r; b if (r == vbCancel) m' j: `( H( v* {: n# W; W
{ . r8 M! p, T- K$ L" Y( O/ m8 X" d7 e
simple.CloseModel(); : B- {) Y$ c( ?" ~
WScript.Quit();
/ ^5 \+ J4 ]* n/ N i4 A$ H } & f' Q( F. p+ U( q; D# f& h! }2 q
}
2 [ B, |' {( ~0 N* c* L/ t( R + [0 h7 V+ H' t: a' e. C3 u
simple.StartSimulation(".Models.Frame.EventController"); ; G. ~# j! V( \
: \7 `* E3 m' Z- N) n$ Z* }7 B6 H/ I8 w
if (simple.IsSimulationRunning())
% `* L% `2 u# T+ Z' A4 k WScript.Echo("Simulation is running!");
% Y! U; e# I4 y% u, ~$ x
9 y1 D$ ~) |$ `/ o, z% C% ?// Wait until simulation is finished
N" U# z; G4 j) k' iwhile (!Finished) WScript.Sleep(2000); 5 m# r7 X8 D* A' q$ i' O
# L O \* F0 e9 t2 _2 ~8 Y- Asimple.CloseModel();
# o% p& Y3 X- s6 Osimple.Quit();
6 d7 z- s" U% _' {' aWScript.Quit(); 6 O& P. }& d# w# r2 X# _5 |
1 f Z% t% G; s, ]8 F6 U) M; G
+ A1 w* i, s2 K4 z8 Y5 ifunction RemoteControl_SimulationFinished()
4 y/ c( Q/ t9 o. W" A{
/ Z5 h: q: w4 |) j WScript.Echo("Simulation Finished!"); |