Example of a JScript
, W$ w1 u2 E- i+ Z+ Fvar vbOKCancel = 1; 6 N6 e, Z! g, d
var vbCancel = 2; / @: a3 r: h9 r! K' R* N
var vbInformation = 64;
2 V) e2 n& L' p( ]0 @var Finished=false; 5 R' `0 E0 y/ V( {( c( B* {
/ H) P( p* ]4 {% uvar WSHShell = new ActiveXObject("WScript.Shell"); & g( a: h5 {) h& M8 b$ g& y
* d/ U1 Y; }9 V3 L4 w, g6 g$ rvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 o( P7 x8 `5 \, k( F- v
4 W, Z$ `0 f1 m8 o$ o( j4 O% X
simple.SetLicenseType("Runtime"); 7 v" S# P) F+ `8 F
8 y! Z7 y& d' `5 o8 y
try
2 S" H4 L2 z* ?' d$ z) ^5 |/ `{
0 K! a& b9 P+ N) N // Enter the path to a model file! 3 z/ z; p% p/ G; W7 L
simple.LoadModel("C:\\Models\\Test.spp"); + v- w* l3 y2 h3 X2 r
} ' H2 @# c! A% m' v7 O2 A {
catch (e) 3 X: V- m: {1 t1 C9 A
{
! |9 I1 ?( A8 ` WScript.Echo("Could not load Model!"); 0 s% q7 f" N$ d8 u# j- Z0 P( U
WScript.Quit(); " m7 E% W) X7 b. r" \1 i1 T
} : U+ E2 X/ A, H& B+ a0 c
0 r. ?8 I. \. s) w/ e8 j
try
o3 ?& g ~: y+ U9 l( x$ f{ # ]) O' a7 m2 l' U' T3 {
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { - E3 h' P; _2 V9 l0 Q1 `
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 6 Z+ ~' q- j: j+ ?* Z
if (r == vbCancel)
0 R M- J# v0 M7 p U: b* Y { ! s* Q4 f" L# `7 A4 D
simple.CloseModel(); ) f" J8 e6 @3 h2 K! V
WScript.Quit(); 1 R: S) g5 X2 a2 ^5 Z* V% a
}
! g# s7 u$ j+ E7 M: X( o} c" {$ N. V q
' t* R. L4 @- {4 a8 I. e" rsimple.StartSimulation(".Models.Frame.EventController"); p7 b3 d3 `7 n6 }# T0 |. X5 z
& |& \7 Z* F; J& `( qif (simple.IsSimulationRunning())
k1 z6 F9 }# h/ p' e5 k WScript.Echo("Simulation is running!");
, n3 i# `7 I- t& x# u
# t' ?2 r! i$ L) ~1 r5 e// Wait until simulation is finished
: N2 W: G- J4 ^. y% r9 Mwhile (!Finished) WScript.Sleep(2000); . \& h; q7 d% `6 U
; }" f2 J7 X8 c* ^simple.CloseModel(); - K" _% c7 l8 P% }' Z
simple.Quit();
- i) D$ d9 d5 R: \; d: e% ], G' sWScript.Quit();
( X/ s& a% A3 {; w7 T6 v! F. X 0 [6 R; f% F9 ?- ~! H+ h" y
% P1 [. e( S7 Y( p sfunction RemoteControl_SimulationFinished() - Y2 f7 @7 U+ R$ |$ B# I- ]
{ 9 y4 H! g$ l9 e; i2 C3 k; e; S+ ]
WScript.Echo("Simulation Finished!"); |