Example of a JScript ) Y h" G( v" k! C$ r' i8 u" X0 s
var vbOKCancel = 1; 4 A( U$ }: l: M
var vbCancel = 2;
- W* o+ ]* r2 Uvar vbInformation = 64;
! I! f$ Y, d& a) t) Qvar Finished=false;
5 d6 T3 B) u, V+ @: U/ t
% y- V: m) x& ovar WSHShell = new ActiveXObject("WScript.Shell"); 6 u5 c8 k. q4 H. }9 q& s
3 E& C3 |: r! {$ H6 F3 i: o3 `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 {+ T+ h$ R$ w; k# e0 n
9 ]+ H1 G( T# n) tsimple.SetLicenseType("Runtime"); 1 d- N5 n% y+ T/ d8 C. {2 X( E
# o1 a( N* ?" M0 [9 `! _- `try
& Q1 @" D6 G/ B% c5 c; Z{
! w/ F5 r, E& Y/ V' @, ] // Enter the path to a model file! $ Z6 e6 ^! J' q0 E$ _4 E
simple.LoadModel("C:\\Models\\Test.spp"); X+ T8 |, L/ M* ~) U$ d: W5 Y
} ( i9 f1 ~2 ~: R- J
catch (e)
% w4 c0 ]! G r1 l9 l( ?9 U8 ^. x2 A{
B' v- {7 w# Y- @, ]8 d- t WScript.Echo("Could not load Model!");
+ i; [& ?) t7 r: } K& E a WScript.Quit(); 7 j& ]3 F; G! o; v8 {( _# D7 C
} ' B! p, _! R) ]6 {2 S {
; v. q" \8 x# ~. Z$ B9 @& e( M
try " C. `& i4 {* [9 a2 \1 `( i" y
{ $ o% A: M+ q1 v/ ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { : `( C L* E9 p y I0 u8 {
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
5 W0 i" [" J0 o9 c if (r == vbCancel) % ~/ S" s& K8 b9 H% s+ Y9 \! n. y( y% j- x
{ $ N* L. {: s0 b: a: g$ i# T8 d/ x% ]
simple.CloseModel(); ( n+ d& v7 L4 I/ I; |8 ^. G
WScript.Quit(); % j Y( D: k2 x3 n9 ]
}
1 C" s8 v, O$ W0 n6 v3 S; N}
* a9 r8 B; P# B0 v- Y" P) O4 @( `: X0 r/ ` ( d+ t4 ?7 p% d& N. ^0 l, ~: B
simple.StartSimulation(".Models.Frame.EventController");
8 i( c) u$ l$ t1 w( s
( W( S( @2 R: Iif (simple.IsSimulationRunning()) , P$ P4 {3 z7 T" i G3 @
WScript.Echo("Simulation is running!"); 6 U' E: a, L1 F% ?5 t3 _+ \2 q
4 \6 Z) A5 A* |
// Wait until simulation is finished
! V5 C8 ?6 B' \- P! Q7 r" i9 cwhile (!Finished) WScript.Sleep(2000); " t E6 d \ ^+ {5 ]( Y: h
7 f- D, I$ q' ^
simple.CloseModel();
) M0 ]' Q; W& r% m8 G, X+ w# W! U6 usimple.Quit(); . E1 g/ R* _/ d+ M! _
WScript.Quit();
1 R0 N; j! w) D& {
: w6 c3 w) O1 W" r4 a+ _ w: Y
+ q w0 [- n. N- l" wfunction RemoteControl_SimulationFinished() & @- z3 B& k6 U6 S3 s
{
: B2 c; d4 {) ~5 P* U' Y WScript.Echo("Simulation Finished!"); |