Example of a JScript / e6 `# j! Q, ^! I- `0 X/ o
var vbOKCancel = 1; 2 n! s B) o, f' e& y
var vbCancel = 2; ( _4 K' m! K4 D0 k. H4 x
var vbInformation = 64;
* Z5 z3 l, D3 l) |var Finished=false; # ^% J: n3 L' n6 ]0 J( i2 \
/ Z t" c ]* i& s: E% Z
var WSHShell = new ActiveXObject("WScript.Shell"); ) H$ M C5 w3 r
% F, u( H. g8 @+ K8 h; s; Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); . d4 s7 j4 l: o& i
) h7 @& d+ F- Qsimple.SetLicenseType("Runtime"); & p7 D! N! ^2 L. Y; u; c, l l
) ?& e! ^: c; l2 f: a
try
! [9 p! O3 h7 }- `+ S{
8 I7 m& W- r& D0 O) O: A. g // Enter the path to a model file! % ]; V! F' K7 P# {; Q
simple.LoadModel("C:\\Models\\Test.spp"); 9 q$ y/ ] Y5 T$ O y0 `0 c; C, i
} ) G5 K W! I! F6 r
catch (e) ! e6 {0 Q1 F, N |9 z
{
9 e" n' F! E) M% q WScript.Echo("Could not load Model!");
1 ]7 o3 j) \& A5 A$ ~ WScript.Quit(); ( W9 Y( t& D8 d' T5 k7 A- x% r
} 9 N$ w- I/ @ U* t2 n" ?
6 d F) T3 T- y2 X1 ltry $ d2 ^+ [: ]& Q5 W' y5 `; ~
{
& C/ O6 a. O4 w4 C P9 D7 ], I# ]3 f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { % G Q! x& J$ g: I5 A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* e% l7 g0 [, H if (r == vbCancel)
& H( V0 h% V( ^. [9 ^0 r3 c { 4 K8 R) K: ?5 U1 W# d
simple.CloseModel(); 1 K, j# |" `* U$ y j: e
WScript.Quit();
; Z2 N3 q0 V( z2 ~& l } : ~3 d' P7 D# s/ N1 }
}
( a3 |' k, ~4 U, {: Q7 _ 2 G3 D0 l, q. S3 [7 q
simple.StartSimulation(".Models.Frame.EventController");
* w9 Y, e) z+ `) e* Q
) z* r; W* B2 K6 i, @8 V1 k# ^/ Nif (simple.IsSimulationRunning())
6 g$ b4 x& X3 P) c WScript.Echo("Simulation is running!"); E; J% V1 V ~* _: @& L) f' f! ]
. P& R& S2 Z4 f. Y3 p
// Wait until simulation is finished
4 d3 V/ J9 {; t& N5 @while (!Finished) WScript.Sleep(2000); ! @8 y2 C+ \5 k6 [2 f6 }# D; g& F
: r8 q2 }$ x8 X/ z7 qsimple.CloseModel();
5 y* _- P# e. Y' z! J4 esimple.Quit();
' O8 y( w1 z% t, [2 z+ Z1 q7 u- IWScript.Quit(); 4 o1 m% i. Y5 a$ l( \% o1 c% ?3 M
' u$ X2 }" [# w$ V, _! X 1 D1 d0 l9 @, |9 C' \
function RemoteControl_SimulationFinished() , q" R& l# F& O2 E0 r, l S
{ . l0 a# Q+ l; o* ?) ~8 A
WScript.Echo("Simulation Finished!"); |