Example of a JScript
# e! l/ A: f) t+ Dvar vbOKCancel = 1; / t+ k. [+ s" @ q
var vbCancel = 2; ; E% v- a0 f D o+ ^* p9 Z
var vbInformation = 64;
& Q7 `. `% S: Y3 e5 svar Finished=false;
4 o: V0 U6 _1 U& v/ D4 L* ^
! J! L5 `: L+ q6 k+ Vvar WSHShell = new ActiveXObject("WScript.Shell");
5 ~7 [3 u& n; E b7 v: d- `3 h. x0 ]
. \6 H. a& Q7 l3 p! W( h3 Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ h3 |* `$ b& L7 o1 L) A' v. h
6 I8 W' |, s3 z! Ysimple.SetLicenseType("Runtime"); ) Q8 {* Y8 D/ n0 W
: b9 q c1 S1 l( }$ p Y
try
. T9 d* Z4 N. `, d" B; T{ $ m3 d( W4 v7 ~ p
// Enter the path to a model file!
' ]+ d A- l+ ~0 `. ^ simple.LoadModel("C:\\Models\\Test.spp");
9 X$ K; l# `5 z9 L}
- r% s, R; L+ _4 F$ q! @& o, bcatch (e) 3 Y1 z* ?8 Z8 w$ B7 c
{
# P, a7 a+ R# D& A, T WScript.Echo("Could not load Model!"); b# ?. j; m! m1 p7 h* ?2 q% N
WScript.Quit(); / ^# e' z d$ H% Q' J
}
% q1 G% r4 ^4 _$ _
# y D+ j- u7 M5 h1 ftry 4 \0 }4 o, p7 z) n$ [0 b
{ 8 l% `% N" N( f' L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
3 e) ]7 i) P/ G) y r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); / P6 e) w0 W0 B8 S2 R6 Q1 g( n, n4 C
if (r == vbCancel) 0 P4 p9 Q0 H4 z) m4 D* p1 f
{ 5 ]: l) |# B/ a7 l; Z( u" X
simple.CloseModel(); * a- j: V. w) ?2 Q+ }$ o# F$ M
WScript.Quit();
$ u& J& F# S( L( T( P }
5 d. ^! A, L2 }6 }' y! b} % i g( i7 O6 X: [3 I
$ u* b6 p+ t+ Z. H. f8 W
simple.StartSimulation(".Models.Frame.EventController");
/ Z$ H3 m2 }3 g2 S5 o' j" ^ . s. V5 c, D" Y
if (simple.IsSimulationRunning())
$ {/ M' [+ \4 Z* i WScript.Echo("Simulation is running!");
% A, r! |5 I5 w4 v( X: O' d
% E! g0 n/ y. i3 S/ v// Wait until simulation is finished
. m( U6 \5 M1 C3 `while (!Finished) WScript.Sleep(2000);
' q p7 \5 ~' C: D
& S5 G* l; W& V3 H( V6 Jsimple.CloseModel();
7 }3 H( W+ [3 Y, d" dsimple.Quit();
$ M8 b9 w- _& O0 a) \: vWScript.Quit();
1 s1 s' E: Q9 i! s: Q; {, `
7 s) F' x g! \' Q3 _9 x: E* R
9 H4 `4 ?) p3 M% q$ P6 p) @' G) M u+ Q# ufunction RemoteControl_SimulationFinished() * J- F+ U- S' B2 i1 U+ O
{ + I6 ?; F* U/ H$ U
WScript.Echo("Simulation Finished!"); |