Example of a JScript 3 ^- O! {& _( z E' q5 M4 L
var vbOKCancel = 1; ) h' ?3 T( g' L6 `/ ~
var vbCancel = 2; , H( q4 |. r1 n. z0 M4 j( ?, j( M# G
var vbInformation = 64;
, a, z, B. R- [var Finished=false;
, e% ` W e2 t$ I: N" d
. J# n# Q+ ?4 x! mvar WSHShell = new ActiveXObject("WScript.Shell"); ; J$ o' f; \: r' k6 J+ E P$ E: z
% x2 S" E9 P; W3 F! Z1 q: {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
v" x: E( v9 o+ h, ? 2 I2 e* _5 {5 k- Z
simple.SetLicenseType("Runtime");
- z" P5 I2 ?) h
1 i" ]1 E) B; V& stry
5 n- ^5 q6 X" |" J{
+ O- n1 H* S& j+ E // Enter the path to a model file! ( d+ x$ t2 G! u6 b
simple.LoadModel("C:\\Models\\Test.spp"); " Z2 _4 I, S7 p1 r6 ?) |5 ^3 K/ C
} E/ R( e" @: R: S3 v5 r( R$ U
catch (e) 4 x5 v# C5 j) \3 s' b: c9 ~
{ 9 S2 z. `9 z- U$ F
WScript.Echo("Could not load Model!");
6 l7 R( |% d( s$ b6 q0 i# ?2 o WScript.Quit();
$ U( q1 T3 [0 L4 Y6 T! T8 b} 6 X$ o( Z3 r" g( Q; L
& O6 p7 S& D# w0 C4 _
try & r2 P- H9 g: U) y% F3 g( u
{
5 r) m& r# B; ?* N) C/ f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 w4 v4 g9 t* P; M! j
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * t# D$ a I" M+ c2 P3 V0 d8 p: f
if (r == vbCancel)
( `4 {+ n+ o; d7 N* N0 ^! j# q/ t' v { 8 Q& H6 I: P" f# N3 q. t: M
simple.CloseModel(); 9 c% N' r3 r9 F
WScript.Quit(); 9 C+ C9 S5 a5 e$ j. ]) ?& ?
}
: p8 _" r' y0 _9 Z} : {. B" v" m8 B% j! k3 E
8 D# z4 s- F4 Z/ I$ w- {# Lsimple.StartSimulation(".Models.Frame.EventController"); ' O& ^2 \6 W2 K4 B$ I. s+ [2 ~. f8 k
/ M6 j* `# [; H: b* F6 D |( H
if (simple.IsSimulationRunning())
" u4 r% s1 ?& S! M! q5 h) m* U WScript.Echo("Simulation is running!");
; D. C: `1 x7 h : A z0 c/ g% L) g" ]/ Y( d# E$ L
// Wait until simulation is finished 6 X, m$ ^: N) z% l) T% h+ D
while (!Finished) WScript.Sleep(2000);
& s" U5 g$ @7 _3 u& ]0 t" s: r3 O5 q6 ~
! V2 Z. ^- O7 n0 T5 G: @+ Tsimple.CloseModel(); % p- Q" `' I9 g& l" c6 k( a
simple.Quit(); ( |) o. {% @6 y# v& b& E
WScript.Quit();
% ~1 W, ?7 k. c4 ?& M: U2 a
, ]- u7 u0 t M7 m ! Y8 M2 c4 O3 |/ ?2 M6 p4 N0 |: y0 q
function RemoteControl_SimulationFinished() ; O$ y- O) Z6 M, J, X# a
{
& t$ K1 [. J J1 l) h W! Y: ~/ K WScript.Echo("Simulation Finished!"); |