Example of a JScript 5 }/ Z( c) p$ S+ ]; D. L. \
var vbOKCancel = 1;
% u6 {2 `/ Y% g; ?" mvar vbCancel = 2; 6 `' i* @8 F. n6 Q4 C
var vbInformation = 64; 7 w2 i; @6 X- u
var Finished=false; # f, c+ e: e4 I8 G/ s: n
( n9 ^; Z \3 J2 m) ?$ S0 x: tvar WSHShell = new ActiveXObject("WScript.Shell");
n P" H' A6 r9 ]4 g7 g, z
+ v/ v$ T0 m; A* X' |& S0 y7 {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ c( d/ G& @$ u: Z. a5 |
$ Z! }3 G5 M3 ]! zsimple.SetLicenseType("Runtime");
: O- H. @; j0 E% P" G" X. g9 h
' v6 `1 S' \$ m5 C3 t6 ltry
$ V% c" j1 m0 P0 k! C{
! x( B: u G3 X // Enter the path to a model file!
n% w% e- q4 Q* x A simple.LoadModel("C:\\Models\\Test.spp"); - _. K( l! x m& j" g7 G/ |
}
6 h0 d( ]' L4 ^4 m9 @catch (e) : }$ q. K2 x: w$ w
{
P9 {6 y3 ^6 m! `, ~4 ~- m WScript.Echo("Could not load Model!"); ( U: u. [5 i5 j5 g
WScript.Quit(); % F+ O* \# G$ r, Y
} 4 \! C/ K7 T6 Z$ v
5 M) U& R( s; W1 t8 `# xtry
9 }- ]% _- a7 G+ R# W8 y{ 6 H: @" B$ ?, q4 ^7 I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " f7 f. U! o9 L
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& o, Q8 D" x: r8 F6 a2 B if (r == vbCancel)
) N. O) S$ L* ~: ~' j h+ E0 H { F0 |6 N2 |0 c- }- U1 D
simple.CloseModel();
# t; W' [1 Y$ d3 x WScript.Quit(); . z7 A& E3 T- u+ A/ f- V7 \- Q( ]
} # q: @, B* P- l. ` M/ _7 f
} 8 j6 b# P; i* t* W
$ ~# T/ B5 {5 W' r6 lsimple.StartSimulation(".Models.Frame.EventController"); . N; Q7 ` i a2 r7 _6 g
5 w* `/ g! ^0 L% D/ Fif (simple.IsSimulationRunning()) ) w' h( i/ l. K, T# ^ v/ S
WScript.Echo("Simulation is running!");
3 h$ s* O! X3 I" _4 D; ]
4 ]- y; e' \& i+ d9 l( L// Wait until simulation is finished 4 [& Y2 l1 V9 q1 C
while (!Finished) WScript.Sleep(2000); * Z0 g0 K" w1 d2 B2 q
1 B6 a) L: n: l! H
simple.CloseModel(); * _6 x) [) {, V4 d8 U% q% c7 m. r
simple.Quit();
( I; B. c# Y0 m. ]/ SWScript.Quit();
, P9 h! R- i' G. ~" e5 n; c6 ? 3 z0 f% f" E1 s* {7 ]" [. x( `
- `# k" C7 m' b2 k2 s( w
function RemoteControl_SimulationFinished() / ]) q: W" v7 l b" [7 R: p0 e9 r
{ \& f! N/ w7 ?3 s: `
WScript.Echo("Simulation Finished!"); |