Example of a JScript
+ P' `3 v4 D7 D/ K$ f2 Fvar vbOKCancel = 1; ' _8 {' P, g( ~( Y* ^
var vbCancel = 2; 8 t- n; I% b/ [' m' F5 B9 V+ y
var vbInformation = 64;
& i7 Z" I3 V# D, a. vvar Finished=false;
8 f4 ^1 f) C6 _. e% X
6 n: g( f; y* R2 r& e, ~/ }9 j# ]var WSHShell = new ActiveXObject("WScript.Shell");
+ x( V+ y3 ~% j5 Z: |# Y
. L& `" t7 w: T' s; y& d0 `% v& Xvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 7 F3 g0 E$ `+ z; J- N
5 Z2 N' q1 L: i. n
simple.SetLicenseType("Runtime");
" d6 @) u$ y5 m Z1 d \ ! W: c# C, U, c, d1 F& [, o; X
try
e5 J5 I8 l E( r{
! ~6 J4 L. x! _/ y& j7 {0 F5 r" R // Enter the path to a model file!
, \2 Y* M, U$ C& k, l' A: i simple.LoadModel("C:\\Models\\Test.spp");
0 S% ~3 l6 G7 d0 C1 j5 l& E}
" Q9 v+ l! J8 K9 G6 W- _catch (e) 7 |. m4 D# t9 r; W4 B4 D1 o; f
{
4 B* I! p; p3 @ WScript.Echo("Could not load Model!"); 8 A' x" q! e! H: V! w9 n
WScript.Quit(); 3 Q- `8 S' ]. O# K9 d4 D
} 0 a+ ^4 w) s, m" Z' o; e5 h( n
- S# a( l5 S- ?4 S( [& wtry . q6 ]% i [. t* g% ]4 ]4 }! ]3 H9 s' ]
{
' `, U/ r% p' e2 z simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
0 G8 r) H5 Y$ J3 x. X r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 ]& e- m! q! g' n if (r == vbCancel)
+ }& R$ ?. u6 I8 Q( x! h+ \7 G8 s { D2 i% y% w% f4 n/ C/ s
simple.CloseModel(); - T, g7 ?5 H2 t9 ]: ^% `9 j
WScript.Quit();
x* d- o# T/ ^ }
& a! M8 g) t: j2 n' |( H} 9 T1 Z' ^; i3 U) A# L) B1 x" |
0 |4 f) n5 M( csimple.StartSimulation(".Models.Frame.EventController"); # {& B; G% y3 M0 @1 J
+ |+ Q& `$ B( m% hif (simple.IsSimulationRunning())
; a1 F/ I3 h8 C9 Z% @ WScript.Echo("Simulation is running!"); ( u5 s) i$ O/ w; U: F, Y$ K9 r
2 {* S# F, K2 @, f// Wait until simulation is finished
$ ? s) C% s! D, E, jwhile (!Finished) WScript.Sleep(2000);
9 p$ y( M- X' S" i T. F- f, p$ e# t, ~/ q6 C
simple.CloseModel();
. }" @* `; A4 M0 }simple.Quit(); - B: x$ f: u# Q: k! p& y5 H
WScript.Quit();
3 u' w1 x5 w# S
8 R2 h8 d0 X, z- h5 k2 m) c $ @% k4 w$ `% }2 \" E
function RemoteControl_SimulationFinished() : d$ J1 B# F: \5 |: K
{ - z6 `3 I; L) H& Y$ ? l1 `
WScript.Echo("Simulation Finished!"); |