Example of a JScript
: n5 C* R# P1 W9 a6 ?var vbOKCancel = 1; ) x# g3 j2 p: f$ b% X
var vbCancel = 2; ; f5 s+ |; H/ y' e( m5 m) {
var vbInformation = 64;
4 A+ f1 e( p8 T& q% ovar Finished=false; 2 I' s+ Y! q Y5 ]. `# v, T
7 B7 |; L% g0 ~& q1 d& [
var WSHShell = new ActiveXObject("WScript.Shell");
) V; S) @2 V8 Y S5 P2 a! y 3 L. I- N+ k6 d& ~8 y; V
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
7 @' e; L/ ^ l% B 4 k8 f, [( n) W# w y. t. {( E0 V
simple.SetLicenseType("Runtime"); # f- p; Z% l" |6 l. _' |( l+ G
6 |" s; l, Z2 A9 P
try
; V$ B8 P1 c7 l2 B{ 9 f. `: S8 f- P" j6 s- l. e
// Enter the path to a model file!
* V: w" n- U8 D# z8 F simple.LoadModel("C:\\Models\\Test.spp");
) r' B# d1 R" p$ r4 f9 X}
3 ~1 P* [; C& t' ^- Ecatch (e)
# ?" p! G4 p+ b{ # ^) Z2 X* P: h; Y5 J3 O
WScript.Echo("Could not load Model!");
- M' J/ d! P h/ K, G0 U7 V WScript.Quit(); 5 _6 q. r5 [$ h& `
} # R: t7 u$ m6 c. D2 X
" r- f/ p0 C2 ]. }try ; K% N$ t* I# ~4 r
{
# r w/ V4 r& L( j4 s) V simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : f$ l8 ]4 h: k$ V* ^
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 x7 ^4 S# B% z: m& H |1 I
if (r == vbCancel) A* r) I( e4 Q& t% u% Y5 K
{
+ o+ X( E. _- ]0 u& T simple.CloseModel();
% f/ n3 m: h- |1 M- r) }7 y% I WScript.Quit();
# Z* o* L G% f" S k( ]8 C A4 g0 H- F }
/ l6 F: A O9 S6 ]} 2 D2 ~5 T( Y4 v
. P# d, l! N0 l7 r6 \simple.StartSimulation(".Models.Frame.EventController");
7 I. B3 x6 N2 y- { " Z4 y& V5 d& X( l" E) Z* m
if (simple.IsSimulationRunning()) 9 a! A" k, l& q a& e! i4 z' ?
WScript.Echo("Simulation is running!");
" S1 h" R1 M9 f5 _; [9 M
; F( d# {- U6 f( I// Wait until simulation is finished " X0 x! b. C& W, m3 \
while (!Finished) WScript.Sleep(2000); . b0 {5 Y' {' f3 A9 }, G; X
$ D& e; J7 I! O8 C" C! I, `3 m0 B
simple.CloseModel();
( n7 W/ ?& ]7 T1 J0 Osimple.Quit(); 8 ~- S3 a2 d' E: j) c
WScript.Quit(); % U; g9 t, Y1 w, _& q8 S
8 ^+ _- ?' G; N5 n
3 V J0 C( ]1 ffunction RemoteControl_SimulationFinished()
, n# ~& i2 s; C& H! e{ ; w" I4 L0 Z! G3 Y
WScript.Echo("Simulation Finished!"); |