Example of a JScript 7 I/ f/ w- O A( W/ T# S
var vbOKCancel = 1;
5 ]9 P1 S) T& S6 dvar vbCancel = 2;
* F/ u' A6 e, A9 z) Dvar vbInformation = 64;
8 \% [# g# s% c, Fvar Finished=false; + y# S. `: x+ ^" d9 k
5 ]$ K. T" N T% o
var WSHShell = new ActiveXObject("WScript.Shell"); 1 K: l* K* G9 }! v8 V
" d; O# k$ r a. t! h7 M$ r
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ h5 T# v H& z: ~* h& y7 ^
, R( G6 N1 _" j; X
simple.SetLicenseType("Runtime");
1 ]" Q8 O* L2 o7 B0 | " E! {3 @$ }* Y: d: j( T* I5 f! ~, y
try
1 L: k) H0 h s9 y{
- P) h4 I) o" {5 C* g$ G; T, ^ l* w // Enter the path to a model file! + b% O8 a% w- ]* r* X, t$ [. l% B
simple.LoadModel("C:\\Models\\Test.spp");
% m. @( j8 _/ h- X" g}
2 L7 a/ |- K. M) h& ~catch (e) 8 S% t& a- d9 f" M; K) I/ l7 G
{
: n) b7 n) ]/ P WScript.Echo("Could not load Model!");
; K" T1 H9 w/ F- f9 T+ f5 U WScript.Quit(); 7 |- ]$ y1 r1 U/ `" x! _1 `
} 2 n* R' \" ~, @+ y! O+ z3 f
2 j# ~2 p! k$ c
try
2 w9 f( M- D# U: u{ ( u! d8 ?; \2 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
) s5 f, {$ j, |" d( U! _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * |& G6 ?) i% d2 z7 i7 p8 u
if (r == vbCancel)
" @ O7 j& C) V C# o# R' { {
; O, @" _% Q3 I+ m+ M5 N3 D7 T) F simple.CloseModel(); * ^ B% y: m, ^: O1 k9 E1 k
WScript.Quit(); K c1 n9 a, a8 E- n" W) }( O
}
D. h- o. A. c+ N9 s; i9 C, y}
$ H7 ?6 \! y) s# h
& Z0 _- r: `% s2 u" I" j) Esimple.StartSimulation(".Models.Frame.EventController"); 8 @% |- Y$ m: I7 y
1 t0 M9 _, K+ O& L3 F
if (simple.IsSimulationRunning()) % c" D& l) t3 d
WScript.Echo("Simulation is running!");
" Y0 d! a) z/ C# V N' ~1 x; A8 f' P
// Wait until simulation is finished
* x9 Q C3 O8 x: j& G. o5 \7 h- N7 Vwhile (!Finished) WScript.Sleep(2000); 4 q, C9 C8 e) Z
' A& g4 R3 b% \simple.CloseModel(); 6 B: ?6 B; o+ X- H8 Q3 f
simple.Quit();
7 i R7 c; R% ]: l; d6 r/ U# O5 kWScript.Quit();
% t8 R- K' p/ ~ ~; ?
: S9 c1 b" d- D( E
9 O8 p' J- r2 K( Xfunction RemoteControl_SimulationFinished() . H: ^9 o+ X; s0 v$ J) V3 N
{ - K" T( z8 j) v5 ?6 m
WScript.Echo("Simulation Finished!"); |