Example of a JScript ! r6 o) _- \3 L1 L( J0 z
var vbOKCancel = 1; ) v8 j# V/ @: i5 e
var vbCancel = 2; ! i; {+ g3 V: i9 O' z" O
var vbInformation = 64;
& H; ^0 c1 j: {; ?: Tvar Finished=false;
( T- h9 K2 W7 J! _
4 _" s% j7 j Z3 I, j' ?, w$ Ivar WSHShell = new ActiveXObject("WScript.Shell"); . M3 g. u) {( ^0 P
5 i4 V# ^5 v$ T6 P. V& h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 N7 h+ e F$ B, k
7 Q; t6 w h: P' M6 \% J, Fsimple.SetLicenseType("Runtime"); ( V- ]- Y8 l& u. R
- p2 R5 p. B! v5 _- Y
try
( i, _8 Y* R4 x( ^6 \+ Q{ 9 p" x2 j6 A: C: }
// Enter the path to a model file!
?( B$ }/ K! [6 n- s' m simple.LoadModel("C:\\Models\\Test.spp");
2 J8 j( i$ f) F( w$ m) K}
j3 g3 |5 b! P, a# k& G, Tcatch (e)
2 x& X- @* j8 S r& G{ $ f! X" S) Y# O& S& K9 w
WScript.Echo("Could not load Model!"); 8 y, p4 t1 {" Y/ y6 N! u* h
WScript.Quit(); " o0 x) f" g! y; ]1 x' b
}
# }0 _* a6 m& b# u
; T; u" W1 g: J9 G8 Wtry
5 v! n$ R5 J& N0 Z7 n{ 3 @( \- e+ N, D8 a% S
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 O# M: U: y4 @- z. O6 V' h! b
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 b, N1 K I5 a! ]3 \1 X+ a! Q if (r == vbCancel) ! Q6 X; y4 Y$ g( I
{
! b) ^1 r. s' Y' S- m4 u& l% H simple.CloseModel();
6 P7 N+ e) w! H, a7 F* x4 J WScript.Quit();
* w. \7 m, b: w' w( q& \/ w x4 g } 0 ^" Q! m4 d5 b
}
9 c; D: o L" ]% Q% Z- g( \! s/ O1 y
: ^; P" O; N( `4 {simple.StartSimulation(".Models.Frame.EventController");
* z! X8 R- C0 e& t3 w # f4 l. }# \2 g% |# L
if (simple.IsSimulationRunning()) $ ]5 S$ y% q- V1 `' A j) g
WScript.Echo("Simulation is running!");
; ~# |/ A4 p# Q w 8 V9 T O( T/ Z/ d
// Wait until simulation is finished
. Y3 X: ^6 d1 I7 \while (!Finished) WScript.Sleep(2000); ! s+ d, K3 I4 A
% z( S3 o& y2 @# W
simple.CloseModel(); 8 ]9 ^$ S% A' Z' W* L% S6 T
simple.Quit(); `1 t$ i' x8 w
WScript.Quit();
7 E- _5 F- W. @) _8 u3 S- b
+ H0 b2 u7 m" K: U3 T" S. g & [) v& n r( \% A2 X4 P
function RemoteControl_SimulationFinished()
# G1 P/ W6 O* q2 I, H$ \ A8 {{
* m" s. `+ I+ H8 H1 T3 j M; ^ ^ WScript.Echo("Simulation Finished!"); |