Example of a JScript
$ V4 L9 k) M* D2 I/ \, lvar vbOKCancel = 1;
- t; Q% d. E! K6 j& q) c/ d/ D0 qvar vbCancel = 2; ) w5 Y j) L- U7 L/ D! ?7 P, F
var vbInformation = 64;
7 j# c( ^& F% ^' b; I: U9 svar Finished=false; 8 U% Y* N0 T& `! S/ g3 L
+ O, G+ Q$ H3 b5 |, H# s% qvar WSHShell = new ActiveXObject("WScript.Shell");
- B: {8 d) y2 W9 j6 M9 O1 N ; p! o' L3 H; m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); $ A! n" X) T" n; ?
0 ~1 I& u1 d9 B. [9 K+ q
simple.SetLicenseType("Runtime"); . D& L3 F h* s, \
/ V7 R! c1 [+ Y" l6 itry
5 m* L. U' Q# d{
* r: P5 k, q, I7 m2 g // Enter the path to a model file! 9 I2 b! @6 o" t$ M |
simple.LoadModel("C:\\Models\\Test.spp");
: f9 ^# |# s1 Y: @7 K8 l6 N}
+ I& N" A6 t" W( l) c0 p/ _( pcatch (e)
) S- d) Y. i3 |2 K" @{
4 c# g- V9 ~) M5 h WScript.Echo("Could not load Model!");
( c& O: u; r8 B! l3 z2 {, t WScript.Quit();
9 G& C' s% a$ ^8 d& V& V# m* N* ] P} " m! J8 i; R+ c
* }6 M) H P" u! ~8 c2 c0 mtry - X7 M# r: B4 j$ L
{ - Y3 t: R1 n1 z; a Y7 j
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 d6 c$ [/ w( Y8 G
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
: Q) b5 P- D' ] if (r == vbCancel)
8 D5 p9 a- R: n; A+ r- C {
. ], }- o! r) m' r6 n r- J5 { simple.CloseModel(); : b/ c K0 o" |/ R
WScript.Quit();
1 M- Y7 v- g" L0 y1 P7 z% E* a }
( R2 _5 k& \6 H |}
+ x6 I( y: [- |4 s7 y3 j4 y5 o 4 V w4 @/ {; b# g8 }; ]% v
simple.StartSimulation(".Models.Frame.EventController"); * v" h1 h2 l# ^
' G5 ?7 }2 n1 H; x; u4 W* T% ~. X4 q5 T) k
if (simple.IsSimulationRunning())
7 M7 [- W9 m6 }" @9 y4 y3 c WScript.Echo("Simulation is running!"); 2 Q7 l; i# d: U# |
" j# M6 p0 {" d1 G4 ^* I// Wait until simulation is finished
; e8 h! {# u- F1 f, `9 i- c% Wwhile (!Finished) WScript.Sleep(2000); ) u+ a- M9 z* z) p
5 q! y& ]( `- psimple.CloseModel();
& _/ a ~$ A3 asimple.Quit();
8 t' U+ _$ I( f7 \0 C( YWScript.Quit(); ) {9 h2 ^7 x# |. Y6 @
# H# [9 F& a* p
" ]* h6 u" V- V6 Y! b4 I
function RemoteControl_SimulationFinished()
W* G1 P3 p( w# ?{ % w, H0 P- B- ^5 R# O* ~8 w
WScript.Echo("Simulation Finished!"); |