Example of a JScript - c+ o5 e/ F4 [# K# |2 Y
var vbOKCancel = 1; 8 G$ S9 d9 h7 n9 c: {
var vbCancel = 2;
" ~ E2 Y/ D. avar vbInformation = 64;
, i0 X+ P3 [0 y- d: @+ Z6 kvar Finished=false; ' C3 f3 P- s; g& O' v$ p, C3 A
7 Y. s8 D; [+ c, k& Z% I5 ^
var WSHShell = new ActiveXObject("WScript.Shell");
/ R3 Q: m8 v# x2 x u
# m3 k; u6 \$ Y( J! W- }1 K* E b. vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 z8 ~* G1 p* G8 v% R6 u' Z o' s- Z: }' t+ f& ^! | J w
simple.SetLicenseType("Runtime");
: o m- Q2 U+ @1 F, e s* } 8 K) m+ a( ]' [. u; V( Y# X( W/ W
try ; c. \" H0 G# d* C0 B+ A- C& H
{ 4 w7 |8 B. t5 H; b7 ?
// Enter the path to a model file! & z1 l0 a+ y! N9 v8 s9 k9 `
simple.LoadModel("C:\\Models\\Test.spp");
, K. S5 u% R. Z/ G h} " {: \; A a6 C( N
catch (e)
5 e9 c( Y. e3 f `( @7 ]! ~7 v{
: J) j' M9 k( y M2 r WScript.Echo("Could not load Model!");
* f6 B6 a e! n4 r$ Q0 ^( c- ? WScript.Quit(); & m8 j6 A( _) Z& g
}
# l6 B/ b& @4 V) N+ w
$ n: R0 T/ q: F$ gtry 5 l: U# |9 E# m5 L) A) \+ a
{
2 F5 j+ V: ]( a2 N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . \$ i7 C1 p9 Q6 O
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * @4 G& S: \! c% r2 [) x% _
if (r == vbCancel) 3 Z' s- O3 Z% O8 [* ^' \
{
" R* ^$ J0 q8 P" ], J% m: G/ l simple.CloseModel(); ! C9 m2 b/ V) ~: x! y* Y
WScript.Quit(); 1 J; p! u9 `) x$ `% S& M
}
3 k$ k) i9 R* x} 8 S5 E7 K# |5 l& m( k
+ {6 b! Q3 ^% [- vsimple.StartSimulation(".Models.Frame.EventController"); ' q5 C5 Q5 J$ l) H2 A* q; W
2 l5 u4 M' |' I3 r ]if (simple.IsSimulationRunning()) " Z; v; ^) g# L `3 e$ k
WScript.Echo("Simulation is running!"); a1 Q% ~4 T& C5 ?
T- t: B0 v* n7 ]# _! `
// Wait until simulation is finished
5 c) a9 h" w( Z* h1 n fwhile (!Finished) WScript.Sleep(2000);
- } E/ }: S! L m$ F 5 g; u+ T, W+ H! G
simple.CloseModel(); ; X: m0 j2 }6 D1 d; K
simple.Quit(); , I _' H$ {" G _: E$ |4 l$ R
WScript.Quit();
- b6 K( f) X4 v/ t0 s- U9 A
2 L9 G& K' ]- _$ n+ ]8 u% M) o: f 5 ~1 ^( y; Z! W# v) A1 m3 u! @
function RemoteControl_SimulationFinished() / H' E. i) O' [" |( @7 Y: x
{ . U' _3 G" z* J- D! ^% x J1 W% ]
WScript.Echo("Simulation Finished!"); |