Example of a JScript
( d. `# q# I( `var vbOKCancel = 1; + H; T) T0 u2 K, N5 |6 Y
var vbCancel = 2;
6 J* W. T( F: c9 u m1 Rvar vbInformation = 64;
; \) y1 r+ ~' I: evar Finished=false;
! B9 v8 b7 |+ N8 J, y1 C* ~ ~; ^/ H' C. i8 z. l
var WSHShell = new ActiveXObject("WScript.Shell");
+ L+ ~4 g D8 j: x2 ] 4 V0 N* h9 U. S7 U# v
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
& ]4 w" |; _6 Y: y: `
& K$ z0 {6 L- V; r5 Lsimple.SetLicenseType("Runtime");
) w# x( o; g# z, L- R
' r0 r4 M8 E3 x8 d; G ^2 h( Etry
' P8 K+ V2 W, Q, A2 ~4 [; V' r{
9 P4 Z; t3 l" ?3 J3 B // Enter the path to a model file!
: p* {6 f; n# _4 V$ y8 s simple.LoadModel("C:\\Models\\Test.spp");
# k6 W2 X* H+ v8 q& n}
; D0 o2 O q7 {0 gcatch (e) # o7 ]$ o) _- m/ H5 ~7 [
{
. I* A& t# b* g- R WScript.Echo("Could not load Model!"); 7 D2 x$ n9 A, s }! `# E
WScript.Quit(); & F+ O5 V* f4 `0 ], \
} 5 [# q2 ~- Z4 H
7 I8 m* I* o& o5 a% J2 _# H) J
try : u2 n- b* Y8 k
{ ) S Y5 H" S+ u7 p* U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 t \! Y( ~: B3 B$ P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ l) {1 ?$ P& W/ w
if (r == vbCancel) $ F& d: p- b8 P& U* J, j8 }
{ 1 f D8 X( [2 i" o7 H3 w, ?9 Z! K- u
simple.CloseModel();
/ r$ d+ T: |: b/ M$ D WScript.Quit();
( @9 n& r- N4 v# ~$ V' m } 8 v% W3 v! X& G9 ]: M$ P
} * y6 C s5 _" f- C
, c* t2 f' Z1 u( g5 l9 L
simple.StartSimulation(".Models.Frame.EventController");
! t9 Y% D, M8 Z8 x* _
5 s6 f* m0 b9 Zif (simple.IsSimulationRunning()) ) P0 c, H& a6 t& a6 S! u! M1 _
WScript.Echo("Simulation is running!");
3 q# k( c* C7 q; F" E( Q
" ]. P- G/ [* R5 n7 m0 x! S5 G. R' t// Wait until simulation is finished - N' m+ P: I( u
while (!Finished) WScript.Sleep(2000);
8 C: h* }/ G4 \9 s- e! n* N
) ]! o" D j0 Vsimple.CloseModel();
3 [# i1 m1 z, Lsimple.Quit(); , E6 t( Y) L4 k3 \0 I: _6 N
WScript.Quit();
% u/ q4 F1 I8 }2 H2 |7 N0 y: h5 y% Y
0 q. o f) w' ^; e. ?
2 _ D0 j1 k6 yfunction RemoteControl_SimulationFinished() ) b: k8 d! A s$ T% y
{ 5 J5 B. b, z1 |) P! J9 F0 K
WScript.Echo("Simulation Finished!"); |