Example of a JScript
' M/ q# k; W. {7 Qvar vbOKCancel = 1; : A8 F8 f3 [: r0 ~
var vbCancel = 2; % L+ n: J; x5 h
var vbInformation = 64;
% F- Y5 ]" I5 F6 hvar Finished=false; & C3 u5 L9 {6 d3 @( y
/ w5 h& o8 e+ o6 ^; a" Xvar WSHShell = new ActiveXObject("WScript.Shell"); ! b% n; i$ f9 T' K5 R: C0 q
5 ]$ i* _3 ?+ W4 h$ c# P4 J) }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. p5 D$ b" O) |6 {1 I: y. n% o , M* G7 P( E# [# I6 w" b; o
simple.SetLicenseType("Runtime"); 9 Q! X+ u! k% {! p9 C' }
! q! ^% B- o* T4 f
try
; w8 P) [8 x% E" r: m' [{
* {3 Z7 L& ?8 F7 ]$ S // Enter the path to a model file! # U8 i9 c! x9 r% P* E
simple.LoadModel("C:\\Models\\Test.spp");
5 G# r8 w/ Y4 P" E" f+ L3 i} 7 h& d9 h9 m% _& N2 V/ S) Z
catch (e) 1 w5 ?2 `0 W9 e( M- y
{ 6 \: w2 l2 s6 i; z$ N1 x. `* t
WScript.Echo("Could not load Model!");
! B* U5 }) r8 v8 E$ V: M, _ WScript.Quit();
+ ?7 z. B- `6 [( G* F8 K} 6 D2 @- n: d: p$ E4 @
- q( L# q% i7 F! H. [! ltry & W( W1 P; s5 v$ X e7 H% b% ]
{ 7 }, L8 {) J2 r8 H0 Z
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 ?+ |% Z; @* U% O) Q r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
. F( a! s4 q& j3 V0 l if (r == vbCancel)
# E# G- d/ g9 v! S. X {
! K: S, ~0 U; T1 `$ z2 f% @% Y/ w simple.CloseModel(); ; I' p" f1 S/ o# `4 O j
WScript.Quit(); ! a V( u- B# S2 x+ {; P
}
! D( i' m/ w5 m} $ K9 a H' g& {( P4 M8 X W
! y+ x" {2 Q, `
simple.StartSimulation(".Models.Frame.EventController");
2 f% m1 [, v0 R: l ' _5 D- D! d: {
if (simple.IsSimulationRunning()) / C! f, T0 E& }: p
WScript.Echo("Simulation is running!"); " I) A, m& m6 a! @! l
! t% O. {' a ?1 _5 [
// Wait until simulation is finished 9 m3 e3 C( ]4 S6 F9 v
while (!Finished) WScript.Sleep(2000);
0 \" }) d+ B+ x3 ^# J0 m* T5 Q, s
" h' S$ _! i, r7 H% Tsimple.CloseModel();
9 N/ }- ]& n; D$ C1 I: Csimple.Quit();
2 U& q. b, b/ Z* v7 I, z, Z/ lWScript.Quit(); + h5 v3 v, a4 n+ `* }2 S
. M' c, d3 K: `. j* k( m
+ D: X% R( v2 t0 ]7 ?9 U" H& ufunction RemoteControl_SimulationFinished()
4 K4 R$ L, O& P6 F9 E{ , F) s% q" R/ W4 Q/ H- b- I
WScript.Echo("Simulation Finished!"); |