Example of a JScript
. f8 f2 q3 t8 K n3 ?) D) f+ r. |var vbOKCancel = 1;
( ^% J8 x- S( T0 y1 T+ Jvar vbCancel = 2;
; @( K# b& t p2 \var vbInformation = 64; & |9 f$ U- y# B. y6 x7 ~
var Finished=false;
/ a, _: n& G- I% U) k' ^" q, Z
. s( ~ [/ p- z( \. L5 g# K' _var WSHShell = new ActiveXObject("WScript.Shell"); : U, {8 ~- r/ N: H1 Y( [. U v
: _! `1 D9 j* [5 R% f7 vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
6 h0 h. S: [ [7 M: h
6 Y1 I) e: b6 X7 B8 _simple.SetLicenseType("Runtime"); 5 P' V2 A8 {& Q D
, N0 d8 |+ {/ }* S$ itry
T h0 m1 Q( g. z8 M{ : b2 B) B& }, m( {7 T
// Enter the path to a model file! % P1 Q" s! |$ ` S, ^; u
simple.LoadModel("C:\\Models\\Test.spp"); : v0 }) P& o- L$ o" S- O& O$ |
}
) c% G' V9 [5 w' ?% N: ?, T* |catch (e)
4 E1 a' f$ U$ y. z5 O4 B" S{
# X: {. n# Y! U WScript.Echo("Could not load Model!"); * h$ J' v/ L1 Z( U& g, p( ~
WScript.Quit();
9 I$ v. m; y2 ]}
" b! [* d9 ~. d t8 q5 O/ v! l + b9 @' u( y9 e8 |/ R4 F5 T" z. j
try $ u$ [8 @6 ^2 G0 z# }
{
' n9 z, B# K0 y/ N" F simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
; s! o/ U( l. Q- h' i4 r9 B2 ~# ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
) g& A! @& q2 @* g% o0 Z* h5 q* E if (r == vbCancel) 7 a$ T* }. X$ ^; D
{ 4 ?' u2 K2 l e
simple.CloseModel(); * ~7 t. L7 s5 g' ~; `
WScript.Quit(); 3 \# U2 E* E, A# L7 v7 O
} & v* o* t& Y) @# c
}
$ J4 V& |$ Z" k$ q% q6 d2 ~
) `8 X v! Z4 d J) h/ K ?$ @simple.StartSimulation(".Models.Frame.EventController");
6 D# h" d# a. z3 }6 u1 B; h5 } . `/ ]& \* I4 Y, i, K
if (simple.IsSimulationRunning()) ) m. U9 p, f, P* h+ x% j
WScript.Echo("Simulation is running!");
) j' x* q- U2 q c 1 T' F! A+ ^% V
// Wait until simulation is finished
% y0 _0 {; A4 ^; swhile (!Finished) WScript.Sleep(2000); 2 M" X) |5 G5 l& A1 [& K# e7 C
6 g& R3 ]% m- m; i1 \" j8 Y
simple.CloseModel();
; n- X' h7 a3 I/ ^, _* Bsimple.Quit(); . f5 {* O9 W4 W% Q1 s
WScript.Quit(); - Z2 i* f- `" n9 J# `
' n5 l% a6 Q! y$ P 6 X# R, w1 D: U8 p$ {1 L4 H
function RemoteControl_SimulationFinished() ! q9 O/ d) \% e) A
{ 8 O/ V" j5 V; g; R+ O- @
WScript.Echo("Simulation Finished!"); |