Example of a JScript
8 x! Y1 a. w$ h9 C8 fvar vbOKCancel = 1; " g( [7 K: ?! E0 [
var vbCancel = 2;
& G6 x9 v& p( h: _+ H$ ^0 b& H1 l3 |var vbInformation = 64;
2 s' q4 c& @0 uvar Finished=false; : p: G$ B- P( l2 f5 Q1 U
N3 ?; m6 y/ ]( C; \4 O" Q
var WSHShell = new ActiveXObject("WScript.Shell"); 3 x5 j$ |3 f* A N" m
1 F. D7 U+ S* y, O& H5 v/ j: @var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % _: f" m6 B" w5 I$ R
- u0 f& g+ Y5 {+ @simple.SetLicenseType("Runtime");
$ p- z+ m7 ^" ~& X' G$ T ) ~, d1 E% i+ C! u
try $ {6 S* _, ~& r
{ % ^8 m3 X) E+ P/ P0 }; i# Z
// Enter the path to a model file! - q- E5 O9 l, B9 ~& r& V
simple.LoadModel("C:\\Models\\Test.spp"); " O5 A6 g( s, R9 z% G' h( P4 ~
} 2 O }# g5 h2 f
catch (e) ) u4 o- |" U3 C; K
{ 2 c- z% g/ ]4 X3 |; i7 i+ Y
WScript.Echo("Could not load Model!");
7 l1 t; `$ [9 u' z* u WScript.Quit(); / Z' s9 D1 l1 `
}
" U2 s, [3 \) l9 {8 r0 m* W$ a. P8 y 5 l! p- \: |( R) p/ R/ ?/ M
try
8 M! M/ \7 W1 T# U# `{ o0 @- c6 \6 a) F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 1 Q4 w6 f) {7 b0 G$ y& c8 S( g5 _6 e
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 ]0 E) z. d; F
if (r == vbCancel)
& W; L. j& ^9 M# y$ O2 s { 5 Y( G. Z5 s. ]
simple.CloseModel(); 1 G* T" D8 ]# B5 @+ `
WScript.Quit();
7 D- c5 M" z P* r4 H2 @ }
1 @/ j2 @0 e0 |: g! m. v} ; o9 H) o* t3 p5 M9 T
" c6 [$ K" h0 ~" \ Ksimple.StartSimulation(".Models.Frame.EventController");
! }2 {4 Z! S9 i( w( O; U
3 x+ c4 \1 S1 o: ^9 E# Y; n% Hif (simple.IsSimulationRunning()) : l( U( u! [7 n- C2 D: ^
WScript.Echo("Simulation is running!");
* _) e7 J/ }) H& _# C& C, h 2 F9 z/ z1 E l. G9 W# C* ^# V: N" b8 J
// Wait until simulation is finished
8 Q3 E$ [* u9 p; hwhile (!Finished) WScript.Sleep(2000); % T. Q6 [! W' `7 C5 _' d
4 c! u. U l( t) Z. k$ a3 Zsimple.CloseModel(); 3 ?, A9 G( v3 \4 J5 x7 l
simple.Quit(); & Z5 S' O3 ~$ T2 d& K* M0 @( |
WScript.Quit();
9 c6 l0 ?1 S. ` r5 V
8 w9 }! \; j/ b1 T3 D/ x% K
" g( z$ ~$ R/ ~# M% Dfunction RemoteControl_SimulationFinished() } A. j6 L7 S* r# x" w
{ , n( X9 U6 H9 {6 O5 C/ c" v
WScript.Echo("Simulation Finished!"); |