Example of a JScript
+ {& {& H: ?4 y) [, J2 b- K8 lvar vbOKCancel = 1;
! l' a; b$ q+ c8 @* M! W4 Dvar vbCancel = 2; 3 g$ B, M9 R* k1 f$ l
var vbInformation = 64;
: Q2 X9 s# S, F7 T$ k1 Yvar Finished=false;
. V( {8 s8 F+ I2 G 5 I) F5 e/ h' p3 V
var WSHShell = new ActiveXObject("WScript.Shell"); 2 W7 ^& y: S i6 i* L; a1 R3 r
) e' m. z4 B! A- Z) Y/ n% \1 K0 u1 vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
! r f- m' x8 o- e; E ) D! K* e0 A2 z' |! q
simple.SetLicenseType("Runtime");
- Z, p1 w: D, ^! S3 B0 I2 } 1 T& R& M; h' d7 p
try % F8 G( ~# r, V8 f& ^, {. y
{ , H8 c H* N! B5 q; V& F- W" J
// Enter the path to a model file!
; y1 \4 K3 @4 [( l& {: ~4 U simple.LoadModel("C:\\Models\\Test.spp"); # T$ Y- T9 K9 S! K
} . n" V p. x. `6 ?4 ^! @! a
catch (e)
9 L8 C; U. g. N1 g6 \+ e# Q{
$ P9 k, E+ O( f, @ WScript.Echo("Could not load Model!");
9 t. Q5 s5 Z6 d9 N% R' z" ^) I WScript.Quit();
* q0 z) _& E9 u- t% q} ; Q) }) s9 g& ~; v
: @& f1 N- K2 S$ I$ J: n( g
try
) A" n# M4 G' S" H9 Q7 O{ 2 ^' U' _3 z" w! y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 t. A F% D/ t$ D4 x* [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 ]& O5 _( M: ^/ ^2 A3 B2 T+ G0 x
if (r == vbCancel) 7 I& O/ d) _4 ?
{ 7 P# b; ]% F$ | y% a3 `4 Y4 N4 e; F
simple.CloseModel();
6 T/ i8 Q6 V, ^6 H: ^) a WScript.Quit();
0 L. @ |8 E, @! e } : k0 c: K6 Y/ z6 }0 J
}
1 w& S9 S: F! A8 I1 I
1 v% _1 F. [9 `7 k4 jsimple.StartSimulation(".Models.Frame.EventController"); $ H S. g7 k {+ Q
. [$ d# V2 D# e2 O3 Nif (simple.IsSimulationRunning()) ; I: @7 j8 i& C2 j) Z" o
WScript.Echo("Simulation is running!");
4 S) A- l, E+ M, M) I# X- Q
3 `$ B& w' @5 n// Wait until simulation is finished
8 a/ S4 [+ h4 |3 A8 A+ n5 n8 hwhile (!Finished) WScript.Sleep(2000); 0 f- i, Y* Y; l/ P, P7 ^
8 q* r/ w5 B! ~. v$ G) ]; K3 w( b gsimple.CloseModel();
/ J; c. x. j% A9 g, v4 s5 W! u. Dsimple.Quit();
. S3 c2 {8 o; p! O( b% A( CWScript.Quit();
. Z! }$ H$ X) } ( E8 ^8 B9 n! a/ b
* U. l8 G. U3 E& m4 lfunction RemoteControl_SimulationFinished()
% x8 {* u5 B% I& x* d, V! ?0 ]{ 2 l/ q. f8 x1 [7 L n
WScript.Echo("Simulation Finished!"); |