Example of a JScript " P: l: k: g: M% q6 D/ c
var vbOKCancel = 1;
% ~" Z, n+ v. { Jvar vbCancel = 2;
- g/ {/ ]7 |8 i4 L4 |4 b- evar vbInformation = 64;
+ E- a9 J/ Q& _# i$ M+ \var Finished=false;
/ G8 z( a3 U& F3 s/ ?# {, u / n7 i A8 r) H( {# n; \! c
var WSHShell = new ActiveXObject("WScript.Shell"); 5 u: K& M8 ^' P6 s. A1 e
3 M- d; J' Z( M2 G# C3 ~var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - i5 T1 p& t; ]& J
9 o# A* c* `4 R3 f8 b
simple.SetLicenseType("Runtime");
" ~4 k/ A% m' f: i' D
+ q. V* G+ I1 I( Z, l( `try
3 L) H0 V2 [8 n2 }{ 9 |1 Z4 y9 @2 N3 I, s9 W( @- n
// Enter the path to a model file!
( |& e; A. B) k) Q/ s simple.LoadModel("C:\\Models\\Test.spp"); 6 r$ m: F5 _7 v+ P. F' M9 b5 a$ o E
}
$ c3 j$ _3 N3 }6 s+ P* H$ y/ Y( ^catch (e) ' k" s9 J" ?8 u& f, C$ s, N
{ . E5 \5 ]3 N1 s" h* I3 T/ l
WScript.Echo("Could not load Model!"); * {4 ~+ M/ W/ S, A0 V: i" ]' E
WScript.Quit(); 6 P2 t: \) d& h/ |. h* H2 s& G$ X1 M% M
} ! b8 |1 ], `- e8 w
& F0 x9 Z' j8 l1 |0 h
try . j' c0 A' P9 ^0 D5 t
{ % v3 Y5 a, Q; z9 @9 X: H7 i( S; f! F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. Y; J" G4 g1 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # [3 @- R) `* }) n: v# s% }
if (r == vbCancel) ( V$ u9 J1 z l+ f
{
, H* W0 s4 a9 } simple.CloseModel();
! M) O S% U; `1 T WScript.Quit();
2 [. l7 s, G1 u1 M$ l. L }
+ X3 B1 Y j: V6 w3 [}
u# B9 k$ [: y9 ~0 Z. a ?4 n2 r) T/ g& |
simple.StartSimulation(".Models.Frame.EventController"); 6 ~. _3 @& O3 v0 U. \
# ]: [4 s4 z1 w6 p/ V
if (simple.IsSimulationRunning()) + F, M; U# ~" t) z' k
WScript.Echo("Simulation is running!"); 6 @ g; O! H3 n7 M& ~* p
- Q* h* Q! P9 Q// Wait until simulation is finished ; c5 Y2 }& r z6 i( r& ?7 ]. O
while (!Finished) WScript.Sleep(2000);
1 @1 l0 L1 E' I6 p1 b/ l/ E. Z ( H7 X5 K8 m+ n* A
simple.CloseModel(); 2 Z) f) y" p7 x1 o/ u: T) U
simple.Quit();
: \* _% z( c% @& JWScript.Quit();
. _# o9 V2 c, b& y* _. y
1 ~( t4 q. k0 P5 `: r5 w+ E* x& ^
8 f! A1 t* F* _! I m/ q% yfunction RemoteControl_SimulationFinished()
; N) W& m) K! f. z* J- X{ $ P1 \) `$ d* L7 W% y9 x2 ~. C
WScript.Echo("Simulation Finished!"); |