Example of a JScript
% N( |2 _2 w) Z$ Z- U4 w' v$ w$ S8 { Z* fvar vbOKCancel = 1; * Y" r; q5 B2 m4 ?2 a- {
var vbCancel = 2; + b* n" h. `* @ r$ z% p" \# T4 j
var vbInformation = 64;
, n9 p9 |0 L3 @ _9 G& h: d) z; vvar Finished=false;
) E; J, u0 B S; e0 Q* m
- u' ]+ C2 g5 Gvar WSHShell = new ActiveXObject("WScript.Shell");
& Y- l$ {! C& Z9 b) Z- \
. ~6 w0 `5 f( W6 \( E2 Rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 O$ E) W. U; Q2 E. s& ]4 Q
. d1 V2 Q8 u1 ?$ K P+ c; Fsimple.SetLicenseType("Runtime"); / _' C3 d' m6 x
& X$ v# d5 ~5 P% Z' |4 j) ]7 i
try 2 z5 P% Y# I. Q2 o' C4 }
{
# y* z+ Y* ]' {, R5 J0 m6 _) d, g // Enter the path to a model file! - D9 D7 B0 N* S9 V- F3 ?; z: F
simple.LoadModel("C:\\Models\\Test.spp");
6 ^. p+ }0 v% @! m9 M}
3 j) {' @8 I/ \3 H/ tcatch (e)
% Q% F9 n; K) O/ M/ u( L{
; z1 |, Y1 E. a5 \! X! V8 g WScript.Echo("Could not load Model!"); 9 a7 B* M/ J; r% ?, z; t5 @) x6 L
WScript.Quit(); & D; p, X& I2 j: m9 W# G
} ! q. k6 H& G9 P/ }" Y
9 p+ m2 p. g: q
try . }; ]* \, @' J g; H, m
{
8 E8 l. k% o9 x# I! I' F. Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ ?) f6 P$ ^) l2 L' g* e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
3 k h; P6 ]1 u1 b; E* H if (r == vbCancel)
, `% H1 s& V) l& { { 6 z. M6 u% Y2 Y; d7 B2 x
simple.CloseModel();
+ a& f% a1 w4 i# V1 } WScript.Quit();
; a& z$ C+ c+ R5 { P0 ]+ g }
6 G a( X( T9 R p}
& M, E1 ~9 N9 \5 {4 [. e' x2 \ : V! w" f! ]3 e6 t7 j
simple.StartSimulation(".Models.Frame.EventController"); ' M) o' C' A' L' Y$ F: Q! |2 _
& e( u9 b5 V, [3 `* h6 k' ~if (simple.IsSimulationRunning())
/ |7 P5 w% a" z! x/ Q. n% b2 [) t WScript.Echo("Simulation is running!"); . j9 z4 W4 Z& m& O0 S3 K, C
! C: R. }. n+ o( c# h// Wait until simulation is finished
9 m. V/ p* ]6 Swhile (!Finished) WScript.Sleep(2000);
" s' h0 W# i# b# ]- U' Q 6 r+ \1 h% a9 h
simple.CloseModel();
1 |% }$ C/ A1 I/ F9 ksimple.Quit();
' S2 j9 v# U( g" @. J; e. c( I# NWScript.Quit();
. O. I8 m2 g( A; P. K 6 V2 ~( ~1 K% s0 I# f1 a
1 U: L8 @2 ~/ V4 N1 p) I, b X+ v6 Sfunction RemoteControl_SimulationFinished()
$ f- f5 d3 |1 v/ o4 W2 Q8 i{ 7 @. Z' N2 j; Y$ G$ w0 `
WScript.Echo("Simulation Finished!"); |