Example of a JScript " Y! p E: C$ B# a) c! d
var vbOKCancel = 1; 4 L! S b- A" R+ ]
var vbCancel = 2;
) k7 j% P6 j7 \var vbInformation = 64;
4 \4 K' R z# a! Qvar Finished=false;
2 N; K4 d4 B+ R
! E$ R1 b0 e8 U# S7 G+ P/ E) _/ u$ fvar WSHShell = new ActiveXObject("WScript.Shell");
3 |7 I7 g& ?' x4 ^! ^, Y' v" |; y 5 v$ [4 H9 x+ Z0 }- Y* `8 `$ i
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% s$ w9 u! g$ M
9 S$ c* ^+ ], csimple.SetLicenseType("Runtime");
|2 k. ?6 E& Y( I$ P
8 W+ Q& q9 C6 w- h3 ^$ Atry " G4 v" o' q) X# r; [ r
{ 2 R" W3 T7 F. m3 ^/ Y% V+ C1 r1 I
// Enter the path to a model file! / B) Z6 B1 _1 Z# Y
simple.LoadModel("C:\\Models\\Test.spp");
3 u- r: L+ S6 a. A% e9 r( `}
* l9 v$ L# f7 b% O" ?5 J. t& Fcatch (e)
# f0 k" x& c, s9 i. M" |! w# H, K ?{ # G( f8 W1 y M% c6 e# P; k
WScript.Echo("Could not load Model!"); ! \4 r( D' ^) d. |1 Z4 v
WScript.Quit(); ' r" @9 C% ^# F- U7 R
}
8 A% V5 V u4 U9 N 0 E0 L5 ?8 {2 v7 N
try
) k4 h5 S, i8 O: s{
0 @( u; B% K) ]: A) W simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - L* o% j5 C5 n" `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ E+ ~% X1 d E4 ~, K8 X
if (r == vbCancel)
. t! h" ]9 t6 x: t { . g2 A/ q6 \4 {8 [9 y+ U
simple.CloseModel();
- t" Z$ N E9 p: Z6 l5 B WScript.Quit(); 5 f. K& W/ z% s: y
} 3 r$ _8 X1 A, X. C% q$ M. l" \% t: @
}
1 ~$ r; |$ O1 W0 m 3 Z7 i0 l# ?. \) L) R
simple.StartSimulation(".Models.Frame.EventController");
5 N6 S: E+ P$ l' X& K i7 _0 n- j% w4 x" e, X: P
if (simple.IsSimulationRunning())
! Z. W3 o' K( ^4 _ WScript.Echo("Simulation is running!"); $ m* o. K& g% e- V7 Q
2 H8 Z5 ^0 T, w$ B) S// Wait until simulation is finished 8 r& `8 Y5 R0 i" Z
while (!Finished) WScript.Sleep(2000); , ~+ [; _+ K5 ?, f' M
% ?0 ?$ D e0 T9 x9 W( R% [
simple.CloseModel(); * w/ X2 [) @3 }; ~; c: m: e/ p% e' |
simple.Quit();
# Z2 z; w W, J" Z( A2 S% OWScript.Quit();
1 p' R5 l3 D; V8 W" G/ r+ M0 C
2 j% O; |- J; m/ A2 A- G * y8 R9 `+ g0 i" j3 E; W' ^4 {4 Q8 @
function RemoteControl_SimulationFinished()
3 G' }6 h4 T3 ? I{
$ W% K. z: ?8 D WScript.Echo("Simulation Finished!"); |