Example of a JScript # K, Q% ~& ^. _* P: t+ H3 Y) E
var vbOKCancel = 1;
8 v' H" g% _4 b- I! G! r7 kvar vbCancel = 2;
$ _6 X9 D2 V5 |( a. l9 s% |6 `var vbInformation = 64;
: L; T5 R" _: G. J% j4 \var Finished=false;
5 P) w" Z: Y6 q/ r4 G8 @ 7 m# c9 `5 R' _6 J2 c0 t& O9 B
var WSHShell = new ActiveXObject("WScript.Shell");
# T; J. Z, c: m: |" B' U 4 [, O; |, r% _& k- j+ P
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 0 g" ^; K$ A, k5 i! n
7 ]" F: O5 s0 H6 j6 @: Dsimple.SetLicenseType("Runtime"); ! g/ B) B( `. M: p) \# E; O1 q4 b
) x- I3 N- U; }+ [1 ^- wtry + V, ~, ~* K; A. J e
{ . v/ R4 \' N" h4 g3 d+ @* d
// Enter the path to a model file!
8 C( I5 ^3 J6 [- G& Z) Q1 f! a( s simple.LoadModel("C:\\Models\\Test.spp");
+ J# g* A( H1 F} ' a# N& \, L0 [( O& y( N
catch (e) # R' W3 o3 E: X+ {2 _
{ $ g8 @% h. l$ I1 _
WScript.Echo("Could not load Model!");
; _) P8 f$ `& |2 Y" p WScript.Quit();
, @0 d1 A% w( c& N' Q8 a, X* F5 |}
- x6 g6 x. J/ E- A2 ?! u/ ^ 4 I/ ~' z- v+ I( T
try ) ^2 D! q0 |# o
{
7 q/ U- H: t" b% y5 ?0 O4 \ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 0 }- T: }' z q9 H
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
( g. o& C/ _/ T/ D% l if (r == vbCancel)
" h, ?& ~* w5 m$ N { ! S# D/ Q3 P5 k1 q; _4 c* l( z- B
simple.CloseModel(); 7 I' x8 W5 H; N$ J8 R1 G
WScript.Quit(); $ |5 f! Z: y: K) _2 A
}
% P3 N2 ~8 H* r# M} ; L# ?' H8 g# g. L% v+ C1 [& K( k
* l ]% b9 m U5 v- rsimple.StartSimulation(".Models.Frame.EventController");
7 A2 S% a' f9 O6 e5 }. V) H % F/ D. `% f2 q0 c- h! h* w( ^
if (simple.IsSimulationRunning())
4 Z3 _; i2 a/ F1 g. L WScript.Echo("Simulation is running!");
2 Y* U0 a1 n1 a' K! C: I$ F: X7 a
, T2 o2 M1 Q* ?. U0 R `: K// Wait until simulation is finished
; u) ^9 H+ l% Z1 k0 Rwhile (!Finished) WScript.Sleep(2000);
4 V" N& J5 c' p5 x+ z( U: q0 @1 ? ' ^0 S) _8 u0 ~. Q' k7 i8 W
simple.CloseModel(); " Q- |5 `* N- B7 y! l1 Y( F5 I% F
simple.Quit();
- o6 Z# _4 B% r: s% k4 vWScript.Quit();
' _% F# |6 b8 a5 B y . v4 j8 a9 H9 L& V
6 W) f/ h |: Z* [7 U; S/ d4 l( t/ m& ?function RemoteControl_SimulationFinished() + m$ z$ R5 ?% b$ t7 {
{
2 @- c9 N2 O6 ^# ^, v, \: l WScript.Echo("Simulation Finished!"); |