Example of a JScript
8 Y) ~$ }% O' i1 H* A. tvar vbOKCancel = 1;
6 J8 s3 j3 Y" Xvar vbCancel = 2; 9 S; V7 Z" v* O7 L- u: I
var vbInformation = 64; & a$ x- R6 P( y* x
var Finished=false;
; _0 h1 C3 I' f# y# y* J * L2 O8 P! Q2 G
var WSHShell = new ActiveXObject("WScript.Shell"); 4 i X5 i, \+ s8 `( |9 I9 G
9 o; ]2 G* u4 v+ l2 g& A7 gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 1 W; h( W1 U# g2 L
- m, Q. C) x2 Z1 |8 _simple.SetLicenseType("Runtime"); ' j/ j7 P4 C- O
8 X! L: h4 L- r' p7 B" }6 K& U
try
u8 ~! T/ N: C{ 1 d7 k# V% I0 K# ]* u6 N
// Enter the path to a model file!
! [1 B0 }) C! K simple.LoadModel("C:\\Models\\Test.spp");
( T+ _0 B! P( m2 Q1 ^1 W} $ c! q! j n Q3 e F8 x8 B
catch (e) 6 {' W" y% M! Y& v
{
' ]8 J7 J; c) w' j1 i WScript.Echo("Could not load Model!");
7 O; r2 m( N5 y; G5 U2 ]) U WScript.Quit();
+ M% s0 E( R3 H. b: s} # O& M, N. U) P* U& k
! P6 D2 S7 j+ \! R+ X( K3 q$ [try
1 x% G: c. J0 ?0 c: t' v' O{ 0 K( [# z. I' e% D9 F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { # P4 T* O6 i7 k/ z. d) j/ F
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * _8 J/ O% V* j, T5 n6 ]6 I9 @
if (r == vbCancel) 9 @0 f. x* i& r. c( c I
{
& `: @5 l, N* o# @7 P) g1 t, b simple.CloseModel();
) I% p5 D3 R- p p0 o* ?* _ WScript.Quit(); - E" x) D% f. c6 i' j
}
. W/ C$ R& {" y- ?& r. b2 S} # p, D4 i4 \8 Y: `% R# k' x
& T* A( \, U2 I4 c$ E$ {/ {( g! F v
simple.StartSimulation(".Models.Frame.EventController"); ) H/ D7 t2 K2 q/ ~& ]9 q: Q$ \
; H- @% W. n( [1 T
if (simple.IsSimulationRunning()) , i. P1 X7 { B
WScript.Echo("Simulation is running!"); : r0 |! P7 c6 F6 ~
8 ~# t9 v7 U: ~# J( L7 T
// Wait until simulation is finished : ^8 T! h; Z2 S% Y: {! ~
while (!Finished) WScript.Sleep(2000);
' C0 F7 U$ D& |) L
* s! B _# H0 e$ L2 o. m) Z( e5 _simple.CloseModel();
% B, W* W( f& ~6 psimple.Quit();
Q9 f7 u3 b- f( H! i X& i' X9 _WScript.Quit();
* C, {5 O: W, r8 l* U
2 v7 {9 `% K2 r- B& U% E- Q . _7 Y! C# `" F, |0 e' S" g6 L
function RemoteControl_SimulationFinished()
: u. ]& L% T& B5 B. {4 S{
: a- @0 y: [; t WScript.Echo("Simulation Finished!"); |