Example of a JScript
- |: M6 a( p N8 H( u+ N. K# dvar vbOKCancel = 1;
: L7 k, u3 U6 D) d2 wvar vbCancel = 2; ) u6 I7 o( q1 A" c8 y
var vbInformation = 64; . V* Y5 W2 U# r" L* c; y
var Finished=false;
" g9 S8 g. w1 V3 W* b 7 Q7 O8 \& L" _& r* \" n3 z* O
var WSHShell = new ActiveXObject("WScript.Shell");
$ ]% `' a# v: ^) n& G9 \
3 a( d- x- h) J; v$ q0 e. T$ Ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # }3 t% _9 k) ?7 t8 C- Z
+ \: q" f$ R: p) G4 }5 q
simple.SetLicenseType("Runtime");
7 ~# k* L9 {9 R2 u$ { J
& i2 H' {% G% x) U0 w/ N$ ntry
. y; y3 L& c7 ^2 \2 _" o* w{ 7 q/ V. ~1 |: y/ B' d* f1 k
// Enter the path to a model file!
2 r& Q4 F) Y" O" U) V2 B simple.LoadModel("C:\\Models\\Test.spp");
0 o% j( j4 N4 A" x y5 r* s}
5 I* T) z) \* I% Q9 Kcatch (e)
9 ~' v- `% B$ Z9 U& {$ I+ E- b, v' f{
: o2 V* T+ R" }$ H+ B3 w WScript.Echo("Could not load Model!"); 6 ]0 {: D N w7 }$ |' N* l
WScript.Quit();
. N3 O3 V% f7 Q# y6 J} 8 D- l7 g! p. B6 N6 {" s
, i# ]+ p( T4 |; {" l& K
try " j; J1 n6 ^8 F. R; j# s
{
7 b ]! r) Q( w7 A3 T3 A! n, C simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
1 n: `4 Z6 {8 Z3 w9 } r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, V: m/ S0 g2 Q! z) Y: R9 j if (r == vbCancel)
1 i, ]$ y3 S) Z2 v { . k9 ]. `8 R$ c1 A" x% I
simple.CloseModel(); % s( t+ ^; }# P
WScript.Quit(); ' N6 b+ [" H, X) n: w5 a h
}
# |5 m" i3 q5 ]. T}
z( M; V' M' U& N+ h; d
3 F' }7 z1 O+ i: B! K# c9 d, Csimple.StartSimulation(".Models.Frame.EventController"); 8 b" J) ]0 k+ z% k( T# X
9 X" [- a# `* N2 r. N8 t; T% _
if (simple.IsSimulationRunning()) * F: E) }/ ^0 [7 c( q5 M
WScript.Echo("Simulation is running!"); , M/ F; |- R ]* d4 Y( J* i2 l c
( Y( x/ H3 l v+ z4 K8 j0 m, Q// Wait until simulation is finished 2 F/ F. C3 E6 p) Y, ~ p4 i
while (!Finished) WScript.Sleep(2000);
; V0 O/ l# O2 T) b7 o1 r' R9 u4 U# A" R + x0 {3 _7 t" N( t
simple.CloseModel();
; x7 K* i! z/ c9 c( ~, N4 ^1 Qsimple.Quit(); , j% B& l$ C/ x9 U
WScript.Quit(); ; J! x5 z4 U+ g3 b1 K- v6 ?4 P
5 y8 U9 a, F: s+ @# v" m* E! V2 J ' R) j5 M: q4 @- {, V1 Y6 T
function RemoteControl_SimulationFinished() % G* w7 ~! x" F3 |2 C8 k8 K! Y
{
0 g+ W2 Z, w5 ]3 M7 G WScript.Echo("Simulation Finished!"); |