Example of a JScript 0 u4 W# z) ~3 p& j
var vbOKCancel = 1;
' `9 h8 _) G$ y: @var vbCancel = 2;
7 x' S \& ~) T: R, T+ Cvar vbInformation = 64; 3 F) B. a$ B9 U# c% ?4 j& K
var Finished=false; 5 B6 u' D: T( B+ _
3 w8 l7 t7 g! U, A
var WSHShell = new ActiveXObject("WScript.Shell");
2 A: h" ^7 r% J( F% O" { " B5 N8 Z( s; P& W- P4 |1 ~8 }! I
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, ~# g' T1 y2 b' K5 Y0 {- J# V 9 t/ F; }+ t$ V0 [$ h8 I9 f
simple.SetLicenseType("Runtime"); 0 k, K. L0 H. Q- g j" N" f* |
% D8 U4 W5 Y$ q* N$ B( h/ i0 Wtry
& y% E. g2 S$ F: M{ ( Q# L, Z, ]7 S& Q6 S' J8 @
// Enter the path to a model file! 7 a5 d; S7 [4 @7 ^ z9 L$ J
simple.LoadModel("C:\\Models\\Test.spp"); 6 C$ f+ w- o0 d, ^' ^
} : J; r( y0 q* r* j/ w
catch (e) ; Y8 c: Z; F! y0 N; }/ m
{
9 [# K- N3 C" s3 P6 n3 ^3 y WScript.Echo("Could not load Model!"); - C: ^, b" U7 v% r) y. M! P
WScript.Quit(); ; w" |4 I: u. K- p- C# P8 D
} : t0 R+ y3 K7 V2 g2 ~% r: N1 Q
* v* A/ g z" H4 A0 S* ]4 _+ z! ~
try 7 D3 l: I1 C: J% `. V
{ 7 g8 `+ q, n. C' h8 P
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
P* D5 x4 t6 `& V1 Q+ B% _ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & L/ i2 B: a4 q. x! I. r) A
if (r == vbCancel) : b9 P! R% z; f' ]9 K
{ : P5 D( l& {2 U% N5 G
simple.CloseModel();
/ Q, K+ q% _7 e( y WScript.Quit(); ! V' v2 P# u$ e- C4 @& p
} # g) u5 p6 K, h. |3 v0 `
}
' \! `2 ?/ y! O' e6 o/ m$ Q V* f+ t
, y) l3 M! G7 ]1 M9 W8 S6 X* Rsimple.StartSimulation(".Models.Frame.EventController"); % N" L- b) x" `) s- L
; w9 k% h2 i N: `! @if (simple.IsSimulationRunning())
& D/ ? N% k5 O t! n; [ WScript.Echo("Simulation is running!"); 7 V; U( r. ]; n3 C1 T! N
# U3 X( m0 ]: x
// Wait until simulation is finished
* e' \, O" x. }: cwhile (!Finished) WScript.Sleep(2000); 2 r4 X: y2 k+ ?" E G# d O% b; m
, [/ R( ?* \: c. X3 R+ I$ ]8 V# Vsimple.CloseModel();
2 u2 y* J% V8 Fsimple.Quit(); 2 Z# ~* g6 K3 B C9 m! u3 W. z( I
WScript.Quit();
7 {: v0 X; F; b3 e; D! x5 x
4 F: l/ ]) ?8 L: C* d7 D' F3 e
( @1 p9 A$ g; \# L! P% Mfunction RemoteControl_SimulationFinished()
! Y9 G1 f0 o3 w9 k, d+ D{
' ~" ?4 d( P% m2 J WScript.Echo("Simulation Finished!"); |