Example of a JScript
- \& [$ Y o! L, k$ avar vbOKCancel = 1;
c% N/ [6 u; ~. wvar vbCancel = 2; ! i. s0 i8 E/ I# J2 L5 M
var vbInformation = 64;
8 t. ^" R0 [7 Uvar Finished=false;
1 ^3 j: z/ I7 e' H & }) g+ Z* t2 ?, x ?/ H, `; @
var WSHShell = new ActiveXObject("WScript.Shell");
: y& Y- b# `' y% ~2 d3 @% t
$ w- x6 W2 |5 ]7 O3 T; b# wvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ! Z, j" D6 B% A2 P5 z* l
, M" E" @" X% S& i$ y& g; c
simple.SetLicenseType("Runtime"); 5 Y( T2 i$ L6 Q( P7 [
m& K' ^5 I0 O9 B8 Z: S3 g0 Y9 ~% R% @try
& ^: ? |' Z2 O; P* f* z{
4 C. t* R8 ]: @( Y/ h // Enter the path to a model file! $ @& @: ~4 e+ X& w
simple.LoadModel("C:\\Models\\Test.spp");
4 X0 N0 a) N9 l ~2 o& Y} # [! o4 b6 \0 b$ @, m+ g" N# ?
catch (e) ( o5 L! u2 F5 d( W; Q2 Z
{
5 O8 _8 t" F2 n% G r9 D& S& Q4 z WScript.Echo("Could not load Model!");
" B7 y+ ]% a2 C WScript.Quit(); & G( c" N6 P( s3 M+ E4 h
} 4 Y ?; O4 M; |* A1 u% O
; R3 ]2 q' Q0 n# M! c
try 1 p9 S' E# K5 z
{
7 m! n$ U0 @: y2 h+ q1 Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 S5 g9 h5 k: Q) P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 7 k/ ~0 ?' M1 Y" C8 e) G
if (r == vbCancel) 7 J7 T6 B# w, y8 G& w+ Z! W
{ ! [: p" e: Q' E7 A
simple.CloseModel(); T2 f5 D; n& y+ q' x, }% X- F" e5 a" Y& w
WScript.Quit();
- m7 D! _( C# M. d d( L: e5 C* } }
6 c! g* |( X' p, M5 Q" I}
! {5 b- x4 F4 X5 B; b ! \6 T7 d6 A# [( c5 r$ T2 `* u
simple.StartSimulation(".Models.Frame.EventController"); & D. p0 z% O( \% r: Q8 T
0 x& V' @8 N! W7 c3 S. a/ _
if (simple.IsSimulationRunning()) * P" a% @' C( X) E f
WScript.Echo("Simulation is running!");
. V. k0 s+ m# \9 ` # {5 A9 D$ h* G
// Wait until simulation is finished
/ ]: F3 Z# B* {% owhile (!Finished) WScript.Sleep(2000); " `; r- o/ Z, A/ N- |7 w: I; i& r
9 C# h7 q" N0 i
simple.CloseModel();
' L* J- t# P! s3 m" lsimple.Quit();
) ^+ s& u6 [2 h9 }0 ^WScript.Quit();
; B3 B& M# g3 N2 L1 S # l( J6 N& h0 {( J
; w5 H" K% m# u1 S1 B. ^- M2 X: I& tfunction RemoteControl_SimulationFinished() 1 V# I& E" Z/ X# v7 y0 i
{ $ g1 ^' a8 @, \$ `4 s8 b
WScript.Echo("Simulation Finished!"); |