Example of a JScript
7 V s& K( e& n& X% C n! J- tvar vbOKCancel = 1; / \' t& g$ f" h6 o8 `
var vbCancel = 2;
! p. Q( s3 ~1 \: Dvar vbInformation = 64;
# k6 ?7 q& u( x* N |! e) fvar Finished=false; 8 [( R+ E: l7 h' x9 w
3 t& c5 U- \7 E+ i1 K u9 pvar WSHShell = new ActiveXObject("WScript.Shell"); + i6 e# K* p1 O# w8 \
0 A' K {3 R9 N7 | b' Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & a0 @ k' r5 | S. v E) U9 ~
+ {5 i' @+ v. rsimple.SetLicenseType("Runtime");
, Q( ]% J; c& U8 A" B6 r+ r
4 b1 E1 \ Q! z- c" D: P/ ~try
2 O; q+ d. I; Y. i0 q; d: C$ h) z{ 4 ?1 N7 T1 D2 o6 D% \$ V1 z( q/ C
// Enter the path to a model file!
$ N& u+ ?( g7 A- P/ O9 ]4 ? simple.LoadModel("C:\\Models\\Test.spp"); 8 \: b$ Q4 ~; T$ C7 O+ t& o
} 8 H0 f& R- w, q) Z
catch (e)
% O+ j& c# g" u$ A4 _3 Q{ % a0 O* o" k+ C+ M8 U
WScript.Echo("Could not load Model!");
( [, p( H0 o; l" b3 J' g WScript.Quit();
x0 G# P. A z }8 U8 I2 P" c}
( O# s1 ~2 N: o- V- M$ `
7 }4 q d- T/ Ntry 8 h# o. O( H: w8 z# l& W
{
% ^8 K6 A- A. A! H simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - S" I3 a" P1 V [: D
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 9 v: C2 ~/ r1 Y
if (r == vbCancel) 9 k- `5 `5 Y& X5 U. d# Y" Y2 t9 n% M
{ 9 i h) B7 I* G
simple.CloseModel(); ( @9 N6 r& ~+ p. @, H F7 }
WScript.Quit();
$ Y; L5 x2 P2 Y } . N6 d3 N' d/ G! o
} # r8 g% E/ F5 ^5 j, Z ~0 A. Q) y
6 v6 A3 w/ Q5 {' o
simple.StartSimulation(".Models.Frame.EventController"); 2 P/ H4 L& a+ P; W* u1 z! Q1 o
( m7 V# f( d6 i+ N* Z9 s3 h {if (simple.IsSimulationRunning()) 4 E) x6 J2 q7 [6 _) Z! x/ p) ]/ D
WScript.Echo("Simulation is running!"); , {: i7 B4 n! \! ~- f/ }# [
, y( I7 P' i. K% Y% ^+ w: f: H& M0 g// Wait until simulation is finished
) k, N: I" R' D6 G- Swhile (!Finished) WScript.Sleep(2000); 0 Y% f2 N! K- G" q( K/ h7 j& s- ^
# P0 Y) g/ A1 _* g0 s* |& Asimple.CloseModel();
+ z& v; I2 G) L( [8 E3 Y# v( Fsimple.Quit(); # |# t3 @# p1 F
WScript.Quit();
% c I" J. V8 T! W* d
, k2 K7 J1 {) h; o2 H * I9 z. D E- @9 [/ K1 A; C) p. K
function RemoteControl_SimulationFinished() q+ _; l4 w: Z% w2 b
{ 6 W0 \1 [7 R& ~5 Z4 ]
WScript.Echo("Simulation Finished!"); |