Example of a JScript
) f! i" T1 f% e: s/ I t ]( Lvar vbOKCancel = 1; 3 e4 [$ q2 z) Q4 o2 p4 K/ j
var vbCancel = 2; , a; f6 ~' E6 {
var vbInformation = 64;
* L$ R% P% K* C: Kvar Finished=false; ' l/ c2 E: @+ L5 U
3 v) \( b7 ]$ Z& l. Avar WSHShell = new ActiveXObject("WScript.Shell"); " h5 s! C8 u) c8 m2 p* r
5 |5 k; Z' [# P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 O1 c9 n5 M' V. }
j. C" l6 P2 E2 W. j6 | dsimple.SetLicenseType("Runtime"); ( x+ G& j: w" T& E: B9 ~2 g
; E! T( E0 T3 j. X5 O
try 6 C4 M9 F) n% S4 c
{
) q; ^- A R K a* [: P // Enter the path to a model file! % S6 k7 O1 S- p7 m# ^: a
simple.LoadModel("C:\\Models\\Test.spp");
7 _# ?7 }: A+ g} 0 ~. z/ ?: m \; l% P/ b/ n9 Z! v
catch (e) / ^( v ?0 t; O
{ : V- G: E3 K! ?) n# B- l
WScript.Echo("Could not load Model!");
0 N: e8 n7 l: M* n& Y% t( q WScript.Quit(); % `; P) J1 B% A1 h) E
} . O( T( D: C8 R
& a1 ^$ W! d* ~2 @+ i: H! Ftry 7 y Z* u* b7 i
{
- D d! j; I3 {* V3 L0 a" L simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 h- [8 k3 u7 h. X, W r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
/ A# A# T" n' _# E8 N/ e/ ?2 m: c if (r == vbCancel) " C! K0 }, c4 v
{
Q6 R2 O8 L: ^; E- T" w( s simple.CloseModel(); - m; z, D+ @# b+ E+ y5 P' E5 Y; i v8 I/ U
WScript.Quit();
9 N8 r9 e8 H' t }
6 o) V$ y% r5 f$ w0 `2 e}
- f* Q+ q" F7 Q0 A0 }
, [) Z0 d) K3 h1 @7 N- fsimple.StartSimulation(".Models.Frame.EventController");
: C' k O) S' s4 H1 J- o $ S+ M+ J6 J* \( X( C- R4 H
if (simple.IsSimulationRunning()) , g2 ^) t& |3 N ]0 W+ |+ G
WScript.Echo("Simulation is running!"); 7 K- V& l, m: p5 W- O; P! R
1 o! e: h9 t8 o. o- O/ P+ z2 n G$ B
// Wait until simulation is finished 8 Y" p: K; D5 P0 t" q# V& d
while (!Finished) WScript.Sleep(2000); / X& v! i) F. _9 y' H
; q) ?8 @1 P! n; H% l0 |/ jsimple.CloseModel(); " \* {2 ~0 u* j
simple.Quit();
( u4 P; {+ q0 S/ d9 o" r2 eWScript.Quit();
4 P8 u {% ^6 P" H
2 \3 b* z! s8 K: Y" T5 t `% C; C6 a' H) p: j& e W
function RemoteControl_SimulationFinished() & W6 v& {5 e' T. T
{
- x3 w1 Y. Q i+ S6 ]* n WScript.Echo("Simulation Finished!"); |