Example of a JScript " s/ Z0 Y" B7 I+ s
var vbOKCancel = 1; , o" s; l& T& K$ L3 r7 R4 ^
var vbCancel = 2;
`( @9 s2 ?4 R3 T! z _ rvar vbInformation = 64; ( u8 Q2 _9 V2 X( U2 A0 U, d! P
var Finished=false;
' u3 Z, O' a3 j k4 k2 x7 X8 I 7 \! I$ j9 k2 l" e5 e
var WSHShell = new ActiveXObject("WScript.Shell");
) r7 p9 x) E: }, T- A
1 c* P6 h7 Z4 K( W5 @* L, |. m$ Fvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: x# d7 ]4 \/ b5 p* \" ^+ @/ q 4 E. v/ u3 O4 g
simple.SetLicenseType("Runtime");
" {6 ~. b2 h0 s
6 b& W: ?0 }' [6 z% T3 W& }try ! M$ Q$ a$ k1 }; x5 m9 K7 L& F& R" r
{
+ O$ n- a: e! F0 m // Enter the path to a model file!
$ X- a9 _8 z/ c) P0 ~8 C6 o simple.LoadModel("C:\\Models\\Test.spp");
# @# z Z. \9 a/ Q} & }( J/ c* ^# j5 @
catch (e) 0 Q# }3 b- \: S8 }
{ 8 H! c8 b9 N) w4 f: @
WScript.Echo("Could not load Model!"); , I5 Y3 `' |6 G( w5 G. @
WScript.Quit(); / o$ O$ W0 }4 p5 Y5 ]* N
} 3 V# f1 [' Q8 Z+ X& b
; M' o+ v) N+ t7 s3 |try
7 I( J6 B- d) N: r- F{
3 X$ y7 L) c' ^8 y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
9 W1 h/ w, A3 f4 B2 G r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
0 V, O/ ]0 s% Z% W if (r == vbCancel)
1 u/ F' P8 O9 w" j6 ~ {
7 }( }& K6 {7 e) g% k* k simple.CloseModel();
- B2 j; A& R! t { WScript.Quit();
/ H0 F5 i; Q7 ?! G& ~& }4 ~ } 4 n y& r' P0 c% @* z7 _
}
1 ?0 T4 O. T, X- V, B+ t2 k! q) ?. o
4 _$ n$ f6 {# w* T/ |simple.StartSimulation(".Models.Frame.EventController"); ! I& S+ I, g6 J1 b% V |3 M9 n; I
: `+ P9 M+ ^. C; e4 X3 lif (simple.IsSimulationRunning()) 6 S. T& E: n$ O! d# l
WScript.Echo("Simulation is running!");
# z! I! E$ A" q2 M # A3 @. V" _, u4 `5 Q
// Wait until simulation is finished 2 b5 `; v! R/ R' ]" i
while (!Finished) WScript.Sleep(2000);
8 Z' b8 q5 c k$ q6 S, A* V1 x$ O2 ~7 i 6 @$ |& I, X: G. m) o
simple.CloseModel(); : o8 C! T3 [: Z( M1 c9 u* U
simple.Quit(); . M5 k+ M Z) \3 g' E ^* O
WScript.Quit();
t) U: x+ W) G' E! |# r7 U* T N
8 F2 Q: i2 k) @/ L0 r' ` " V2 y3 o/ t0 O& s- Q
function RemoteControl_SimulationFinished()
. f, c: |% Q/ i% u D2 t% J9 {2 F0 b. h{
% q! R S* [. r/ o! k; O WScript.Echo("Simulation Finished!"); |