Example of a JScript
3 C4 q* \+ q- _5 W+ P, Tvar vbOKCancel = 1;
6 j+ ?% G& G0 L* v1 N, M' [var vbCancel = 2; 3 s) X; f8 U* K
var vbInformation = 64;
2 Q4 Y1 G6 Q; G7 u8 lvar Finished=false; : W5 O0 b0 D+ q/ v% g+ h! K
H" B# n, |) f# o, M$ b" uvar WSHShell = new ActiveXObject("WScript.Shell");
: ?9 O8 j- ^$ s" a
0 @! q8 F* a( yvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 w! e- s) |5 \" \2 A
6 \# T- ^4 E9 fsimple.SetLicenseType("Runtime");
3 a' y) S( L& S e0 |+ L
% Q, d2 J1 f' p5 stry
* V- X8 }) q+ F* ]4 `' g{
. U# ~% n3 L* Y( b% d( J# t // Enter the path to a model file! 4 e, Q1 P) ]0 P, b* e1 _* H. q; ~
simple.LoadModel("C:\\Models\\Test.spp");
/ D8 y+ {. Z5 l* q) P' g+ v; p}
( E" m$ _6 l: ], v3 f- dcatch (e)
' X, a( H+ ?* O6 ]{ + o' M6 p! i* X+ f+ H9 o( s
WScript.Echo("Could not load Model!");
Q6 [6 \# N5 O' G& r& I+ b WScript.Quit();
( ^: d$ ] A# E* }- `} ) J1 \! u/ w' L2 U l! P) h. p* ]
* h5 t- K9 E. X6 U3 U7 Btry % P8 x4 Q1 S' W3 P
{ ! n, N& H* j6 }4 c) t' k( h. G* z3 r* p
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 T: U5 l- i( x- X# H, w [ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 1 V5 O! B2 \$ C! p/ r8 x0 M
if (r == vbCancel)
! z2 ~3 G, X% Z+ L0 h% |1 @ { $ K* W \4 ^+ r; P
simple.CloseModel();
' `3 k. b6 m/ L7 N( c WScript.Quit(); ' X, s1 U& J/ l" _& ^
}
. w' o* I K& K: m, ^) `}
3 |/ ~- ]7 H# r$ E
- `. B* Q) M( ?# V2 Z6 hsimple.StartSimulation(".Models.Frame.EventController"); 7 @. z3 @8 L+ A7 K
& D0 }! M8 X' Wif (simple.IsSimulationRunning()) 0 |: W" Z$ j/ @! v7 b2 r
WScript.Echo("Simulation is running!"); 0 A) f9 \- s1 C1 q$ o9 B, H
! K% |; U3 | F9 v) _ M$ b
// Wait until simulation is finished
& {, p0 C. c5 S2 I9 twhile (!Finished) WScript.Sleep(2000);
- L3 X. s" f4 m, j0 K 0 T0 V& d# S5 u
simple.CloseModel();
0 p7 }3 ]3 n( o$ Z1 ^% _& t/ Rsimple.Quit(); " o% L* F; \* l* u7 W
WScript.Quit();
! V. X5 Z+ `* ~' u
6 O+ G0 M( q1 g) @* R0 z
. r# d; x; Y2 Y" w/ X$ ?function RemoteControl_SimulationFinished() . B; O b& `5 a0 V( v+ M' e' c" D3 y
{ 3 R# v% ~1 i" ^: L! t" q, \
WScript.Echo("Simulation Finished!"); |