Example of a JScript
( B5 O5 t( j7 Q3 @& H" q- v* kvar vbOKCancel = 1;
9 f; {- f- z1 V9 `var vbCancel = 2; 8 _% P; [5 ?0 a7 y9 c
var vbInformation = 64; 9 `% P U- b7 z# h% E; M
var Finished=false; : e6 u) k3 l# a
0 p' a) C" ? M# c, {4 ?7 R& O
var WSHShell = new ActiveXObject("WScript.Shell"); 1 \. i2 K* s8 o+ p: o) H2 N
6 N- D* Z! ?+ T) {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 @6 ~5 X6 K! A2 q8 o; @ q( I. U
( d+ R+ L, C( @* O1 gsimple.SetLicenseType("Runtime");
' X; N$ ~$ |, _3 d0 E: `& x
" _& Q; n( R+ @4 J1 w! {) V/ wtry
+ j) p5 H+ u; e{
4 ^8 a5 a/ ]6 M, z; T // Enter the path to a model file!
3 G- l/ m) ~- } Z9 V; p! J simple.LoadModel("C:\\Models\\Test.spp");
6 _7 o% ?1 w; x} - V* ~, o2 f% O" d# U
catch (e)
$ m1 p" Y6 c" R. A' F{
) H; X* U+ b/ \6 Y& n4 ]1 z! ?. g WScript.Echo("Could not load Model!");
$ V: W0 p; d# r. e" j WScript.Quit();
5 W( m3 N- G2 { @' p2 q( k} ! t; w( Z) V- Q8 `
8 c( y. }/ B2 C
try 7 T0 S4 B: y1 L' |2 J2 l/ C0 t$ \
{ ) X* b# U1 ]5 K1 _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - z- {1 r4 e! m4 |. O$ w
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * e. P0 [( ]9 U2 p6 D( Y) x
if (r == vbCancel) 6 i/ C$ s0 k; m/ Q8 e- k: ?7 H
{
$ \! b: z7 |6 L& P6 _: a simple.CloseModel(); ; }( f% i) E3 H- q
WScript.Quit();
; S4 F. r3 Z( ~7 i } , c7 l+ @8 Q/ V y# c) i
} / Z7 ^1 x& ~% @0 G, n4 A# ?( i& q2 `
- \/ S0 U6 |) m3 d9 esimple.StartSimulation(".Models.Frame.EventController"); / l+ i- c( F: E0 V
( e3 G0 h0 B' M7 \: ]4 [! z. G1 _
if (simple.IsSimulationRunning()) 7 e, Y+ T8 G) |* ?3 A1 e
WScript.Echo("Simulation is running!");
/ ?9 X+ i: G2 Q2 e2 P& P : n! y' E5 E, p2 Q
// Wait until simulation is finished 9 t& \: y2 e# e/ }" X
while (!Finished) WScript.Sleep(2000);
( [/ K# \. \' n
- L: g$ t- d6 ]( j. Nsimple.CloseModel();
8 ^6 f1 q' @: o, l$ G- w' hsimple.Quit();
% m. G* x$ T6 e1 H- J9 Z" @& l% mWScript.Quit(); 5 ?! o/ C0 @, f. }
& z) R1 l/ c% Y+ t$ Z + k6 e4 H2 u; s/ E2 U4 M
function RemoteControl_SimulationFinished()
- @4 |& b' l" P{ 1 o* K7 Y, E _4 J! k+ ]* T3 x
WScript.Echo("Simulation Finished!"); |