Example of a JScript
: e9 V; c+ Y4 n' L6 g6 Q. G; B7 evar vbOKCancel = 1;
* D( H. @" o e# xvar vbCancel = 2;
) d' L6 t" E/ ovar vbInformation = 64;
+ G; `6 U/ j0 V4 q5 q" z+ s" o Cvar Finished=false;
% s8 N& z, m" M. G/ k6 d+ f# m. I. z& p
1 H1 t. t: a* t- J& Z" y1 [var WSHShell = new ActiveXObject("WScript.Shell"); 6 I) l" r7 g2 f3 E
5 M$ `6 [) [( F0 s* _0 [1 N! C" b9 z
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 r3 P8 L" S! K% W( }
& r0 Z. h1 K: l% @
simple.SetLicenseType("Runtime"); 2 l- H' g" P# [* I0 g0 R
1 R8 X0 ?7 Q& g* Q* ltry
$ f& h- q: `$ k{ ; ]- b% m% y" |7 u
// Enter the path to a model file!
3 G& y$ N( J4 |' c simple.LoadModel("C:\\Models\\Test.spp");
W( s* |3 k& p! k} + t" P* f% k5 w9 r8 r& n# j
catch (e) 1 F. F4 e. B0 |! `/ I
{
- H& w. ~5 A: B/ }( H$ Y, _ WScript.Echo("Could not load Model!");
$ I: U$ i) U( W: z WScript.Quit(); 7 Z c: E. ], m: l Q3 B, t. t9 S
} 0 P+ U0 E0 X. p Z0 v; o: L" r
. m6 {7 y, O* j5 e; I( Ttry : J0 h8 q" B/ c! n0 z }
{ 1 G0 z t: X0 C5 Q6 n: c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, T7 C! M- C# y1 Z/ l+ T) I _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& _% C$ U" h$ e9 O if (r == vbCancel) 4 V" j9 x" E$ w1 j! a
{ ( F& K) V4 K5 m/ N3 S+ e
simple.CloseModel();
0 j( M# T4 Q" P WScript.Quit(); * q3 |2 h, U) x9 d
}
# i; x' @- `; Z. Q7 j( ]0 R} / f: h* U5 M& @9 G H
; s$ u. n; |- n1 k0 V1 R( Z5 x+ w& ysimple.StartSimulation(".Models.Frame.EventController");
; r% I+ N- R4 ]4 K& n& t / Q2 U- F5 Z* W1 Q% |. A
if (simple.IsSimulationRunning())
. e5 |0 o& i! S- v) k: y6 |6 g WScript.Echo("Simulation is running!"); ; q. y, g$ [, F. v. i
: ?1 I9 T# G) Q6 O. s3 [// Wait until simulation is finished
7 A3 W2 ?" H' `: Cwhile (!Finished) WScript.Sleep(2000);
( C7 K9 T7 ]& h" l# A
. f4 c* v+ t7 K) P' }" Hsimple.CloseModel();
8 c; V0 L3 p2 o! ]simple.Quit(); ! ?2 Q' D. I* N0 S3 Z( F
WScript.Quit();
$ {! G/ s }7 i4 N) i5 \/ P/ X J' L * B* I: ]6 F) `4 Z/ J; a4 x9 R
0 ?1 x. N$ t+ F: _+ P! a
function RemoteControl_SimulationFinished() # Y: ^" H/ w! E" ~( S6 ?5 y2 ~; f( x
{
7 j6 H/ X( k( X WScript.Echo("Simulation Finished!"); |