Example of a JScript 9 w. G. G4 L) n/ Q
var vbOKCancel = 1;
# z U5 x" l: ~$ L8 y7 nvar vbCancel = 2; ) k* ^4 E6 [. v( I. ^' K: l) }
var vbInformation = 64; ; ?0 r6 P9 y9 U9 r) _; s# P6 ^
var Finished=false;
" W5 N* W1 ]6 }+ Q2 k$ l
* q% O% ]5 U; U: F kvar WSHShell = new ActiveXObject("WScript.Shell"); , A) H" r. G: b+ L8 c9 o4 O/ F. h
1 ~$ O, T: {) M7 O7 y# ~
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 2 I+ B/ o8 Z& X- k( k" O* _- Y3 Q
) x1 f- \' w0 z+ O
simple.SetLicenseType("Runtime"); " i; F/ {, b3 D9 P% T
7 L* T, `& O1 c% P' i% v3 Ktry 8 X) `( V* z2 ?; D6 G
{
1 V; h! l# [1 V; I // Enter the path to a model file!
( v' m% _9 V/ V5 ~ simple.LoadModel("C:\\Models\\Test.spp");
1 E% ]8 n( T! p% f: s9 C}
% W' O% c- X0 w( d. Scatch (e)
, `- g% _# Q" S- j. @( y{ X3 ?) w3 m; d( S. {" H9 S
WScript.Echo("Could not load Model!");
1 m5 |! o. _* p, J( f- g9 U WScript.Quit(); 4 |0 I4 z# j! M. j4 E
} 5 M9 x( p* B( d7 S( f
* F- j. s3 Z) O5 Gtry
4 O& r& s1 U* } K/ o9 H6 y{ . z( ^" n+ S0 ~! i
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 s$ [) ^$ R8 K0 q5 h- ?( @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) [! l9 _/ Y% K3 }. s5 u
if (r == vbCancel) % ]% ?# |: ^5 C- ?0 b
{ + s, w( r3 s4 Y$ O7 S- Z2 a M
simple.CloseModel();
6 a7 I6 e+ [5 | WScript.Quit();
# u1 a- F# ^8 B+ l: F3 [( G% w } & P6 X8 z8 m2 j V$ n
} # R; t% E8 z4 X$ D1 d+ z( U) U( f
~ [5 J# @8 y/ X B _
simple.StartSimulation(".Models.Frame.EventController");
& z! @' K" Z" W+ e0 e3 `- [' y & R( o4 `6 }; C0 E2 A% d
if (simple.IsSimulationRunning()) 2 Q1 h# p8 Z5 D/ j' Z1 G
WScript.Echo("Simulation is running!"); , }0 H9 r" I; B/ ^4 M
/ G8 z/ G( Q: u+ D) @6 J+ D// Wait until simulation is finished , w4 v% F) }) x- P
while (!Finished) WScript.Sleep(2000);
9 x- |# `8 V/ Z
5 @3 g; T4 V0 ~7 [: ~# ^simple.CloseModel(); 7 _( W6 n4 _) r% _( E- ~
simple.Quit();
# e( b. v3 N3 k5 L# xWScript.Quit(); ! T) k4 o" H+ k. p( u" }! C6 m
$ u+ N0 p+ b! t, y6 L- n
( x8 }) u0 K) R/ G! K! e5 d) G. ufunction RemoteControl_SimulationFinished() , h$ i7 k, S1 d& J
{
3 c3 B- ` p9 Q8 }; q WScript.Echo("Simulation Finished!"); |