Example of a JScript
9 P! Y* P5 O( n2 s. k) hvar vbOKCancel = 1;
: r4 B- C5 F4 P) m0 H0 V! Q4 avar vbCancel = 2; - G# M; K" v1 E+ G' Y
var vbInformation = 64;
+ t0 {* x" M* S1 l+ e$ d1 wvar Finished=false; + X: k Q% G$ J% ]9 P' c! N
' ]: b+ [: m. H a/ ivar WSHShell = new ActiveXObject("WScript.Shell");
4 C# ?4 r8 m: e2 V & q1 ]* U: p- j6 d
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' q3 A/ _. Z9 W
# F( F6 L. P4 x1 [simple.SetLicenseType("Runtime"); , \- C" o& c& J$ j" U6 j
' }3 t1 _# L+ ?try
' a+ w, b$ u: M* ^% h{
7 d3 a8 x; d' w4 N // Enter the path to a model file!
; j- ~9 I. ]9 M, k simple.LoadModel("C:\\Models\\Test.spp"); # H( ` j/ f# i: q- `* i3 I- z
} / ^& B! ? n9 g
catch (e)
. L+ ?9 }& B3 j{
. p/ N) p3 F' E5 p WScript.Echo("Could not load Model!");
; i2 A; B4 @( s$ d* x2 i WScript.Quit();
4 H4 D+ Q+ A5 n! @1 l- c; f}
# E: t) ~, `) n , c: _" A4 P2 t3 K0 b
try
, F; v# E/ I5 z% k4 r% `{ 8 r( ~" V4 ~- F8 x
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ L6 P1 V& Z1 R3 Q( U$ y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); $ D0 ]. y4 R5 ], ?$ |4 h2 ^+ V
if (r == vbCancel) 8 w" i# I) V9 B5 B& x( Y* k
{
; B& B% z, L- g) Q! W }7 V9 `! ] simple.CloseModel();
& y- Z! A/ y3 c& d: d! J WScript.Quit();
. d& ?5 y1 N5 b3 q( L }
0 y' X. Y0 m, u- z# ? k: g5 A' J3 Q} " X' T" P$ R$ n. g N& l" p
6 K6 g% p5 |( R" F, Qsimple.StartSimulation(".Models.Frame.EventController");
6 _* e8 ~. u. U( _, X# n7 \
* j ^/ e! l, X( _if (simple.IsSimulationRunning())
. p! O+ H% q! A9 b/ Y3 L WScript.Echo("Simulation is running!");
# E. C1 q: x4 J; Z
# r* U# Q1 x0 J \/ e$ s. G// Wait until simulation is finished
% A& T; e' w: \9 c+ swhile (!Finished) WScript.Sleep(2000);
' c$ M, k/ E& ]! N9 D . L) n2 O* T5 a9 ~* x0 M. W
simple.CloseModel();
( a' y. \8 Y* r0 x) m8 Lsimple.Quit(); 6 d6 @% O! c0 S4 {
WScript.Quit(); ^8 f% z6 C1 {5 J% N
- K* o( E5 n; [6 t; s# {& S8 W, h6 d ' ?* s* w8 z, }- P U/ v) P6 b
function RemoteControl_SimulationFinished()
+ `* e* n. D" L9 |9 _{
/ q' a N5 J/ m* J( y% V4 M! j" J3 ~* @ WScript.Echo("Simulation Finished!"); |