Example of a JScript ! m5 w. Q# B1 B" c4 S, {2 t2 B* [
var vbOKCancel = 1;
% i c* i7 f$ S, k9 b0 P, Wvar vbCancel = 2; 8 d, E0 \( B8 a8 M
var vbInformation = 64;
, d( \/ ~) }) S+ h: evar Finished=false; 7 [4 G' X/ I# c% S
8 f* ^7 h! S8 q
var WSHShell = new ActiveXObject("WScript.Shell");
7 `0 z; y0 j) Q( Y7 |3 c 8 R0 R) t2 R/ h5 d' G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 p* G) P8 ^( R# b$ Z$ m9 h 9 `) j. s% @6 A3 d
simple.SetLicenseType("Runtime"); , P+ e( n' s9 c% I
, u* ]( ?8 x* _) d( ^1 N% l8 Y
try 8 |( C6 A* K- K3 b! V4 T
{
. q3 J+ h, m6 z' h // Enter the path to a model file! - I( l5 W! n( _: C- Y9 G
simple.LoadModel("C:\\Models\\Test.spp"); : t/ x1 a% r+ ?; k' q
}
& [" G0 P! a% K' ~# K5 `catch (e)
% J H: \) l+ b( K9 m{
- W4 ?& K" N1 u& c WScript.Echo("Could not load Model!");
3 Y5 C) c; ~' s, p% R$ I& Y% N WScript.Quit();
6 n4 |/ s6 Q n) t* g& ~* E5 G5 R} , ]- G0 @8 ~7 f
) D4 K- }% u$ W
try
3 M. [ I1 {' z9 l{
( Z+ S- B$ A) j* R7 I+ R- t+ P simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ) [% D! d0 L9 D$ y
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 S! A2 t, t. H; o8 _
if (r == vbCancel)
5 ~3 }4 V* ^) ?8 i! a {
, ?, M* f/ c6 l4 u" j1 W simple.CloseModel(); , U. ~8 ~, \; t* C
WScript.Quit(); * q! O: u$ f' _( h$ i# ?# j
}
# x# _+ Z1 h: ?4 ] t# e9 V} " _: v% R* ~+ z; O6 E
. v3 f9 @8 @4 c' f+ w6 nsimple.StartSimulation(".Models.Frame.EventController");
& g8 ?& Z" X5 o u3 d 0 P" K$ R2 d9 ^; G6 {% P
if (simple.IsSimulationRunning())
9 \( e$ f% ?5 G8 c: l WScript.Echo("Simulation is running!"); ( F& B' W% Q8 q% w. J9 `
1 a8 m. N, D: q- z& C// Wait until simulation is finished
# O$ h- c9 r o2 g% Qwhile (!Finished) WScript.Sleep(2000); # |. v$ u4 W: D1 F9 k& g8 H4 Z
2 k6 }, [& G+ b) _7 a. m& ^
simple.CloseModel(); 0 y7 P1 J8 k, ~2 D* |3 M* L
simple.Quit(); 8 x& l1 |( }. {8 T6 ]7 O: j& x
WScript.Quit(); % u. l; H/ X9 G o% q
( Y% C: U; u2 M& T3 Q
+ F/ s. b# y( Q2 n9 Ifunction RemoteControl_SimulationFinished()
/ H+ m; T! [" u, ^% N1 _; i" j2 N{ ! Y5 ]7 U3 [6 i, A5 ~( |( b
WScript.Echo("Simulation Finished!"); |