Example of a JScript + q! N# I2 M7 h" \9 c/ x) a
var vbOKCancel = 1;
% A1 Y. N1 h, O m3 _( Uvar vbCancel = 2; ( J2 Y# r' [2 n) j1 Z
var vbInformation = 64; 1 i2 P* O% Y4 b9 C4 U4 C: m
var Finished=false; % [; W* i' i' P4 m
) C7 J# e7 x7 J5 }# `var WSHShell = new ActiveXObject("WScript.Shell"); . U6 B' _6 `$ E
$ J& p) t" h" q. [( {3 V, C, e, Wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 y5 u4 V3 g4 H9 Y& y* A4 f
4 y1 {0 Z( ?( u8 F4 c9 w
simple.SetLicenseType("Runtime");
) j: X9 D% p9 \3 [
( u P. q# l0 k4 p, I5 m8 O0 Gtry
) |8 L: S0 M) U) ~3 m C{
$ o! c/ d; k. Y# F // Enter the path to a model file!
" ~" Y* D: Z! K6 M; w0 x2 \ simple.LoadModel("C:\\Models\\Test.spp"); , l# z6 j2 w8 z% \) r& e
} $ ^3 M/ B( {1 N7 G$ T
catch (e)
6 N" X% F ~4 _" T{
7 P! O& Z' p" p! i$ x5 C( q WScript.Echo("Could not load Model!"); + c9 L/ B. l% M1 p3 _1 R
WScript.Quit(); ) A$ v! x' F; A* w
} ; J! }& q% t6 I D$ ~. f. B
& u8 \' [' Z( ~3 G! H1 v y3 |
try
) n( D; S" }, A9 i8 J2 c{ $ H! N% ^) e ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
s7 ~, g% o. t% ?/ g; D r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
U- s+ I# x/ n' M if (r == vbCancel) * w1 P" _9 s K. p8 P; R4 b
{ L; R% H- v% ? F% @; b4 c# f
simple.CloseModel(); - t M* v* r4 Q
WScript.Quit();
$ h+ g( o! k- d }
3 ]. a5 _: q. T$ E- C6 P}
- E3 W: O1 [- A6 x! @6 [. a , k' q2 u& d) f: T j# U1 s! ]
simple.StartSimulation(".Models.Frame.EventController");
3 K0 |8 u9 [7 E1 J4 A 1 Y0 ~) p2 Y9 e; E
if (simple.IsSimulationRunning()) ' D% n) W% G/ P7 d
WScript.Echo("Simulation is running!"); 7 w# D4 M7 {- M* P% i+ E
3 {1 C+ j2 a" J1 E6 z
// Wait until simulation is finished
# k0 d6 Z: `! |. a, }; d- U6 h9 Hwhile (!Finished) WScript.Sleep(2000); - j, e6 I: {3 L7 g: R" t" m
# q0 @ D( k9 g1 t
simple.CloseModel();
+ G( }- S% g# R9 wsimple.Quit(); % Y! c$ u R# z
WScript.Quit();
1 P5 f6 B& q) B! B- }/ C' L : X5 o$ X8 H) `8 {" O! l9 l7 V
; Z- o* f. V8 L6 n- K! C0 ?function RemoteControl_SimulationFinished() 5 \: t, [8 d2 P9 K I V8 Y6 T9 U
{
" ]4 O0 j$ d- M9 \ r" L, S8 I! q4 ] WScript.Echo("Simulation Finished!"); |