Example of a JScript
( b6 n; t- v3 Y1 Q+ f Ivar vbOKCancel = 1;
7 t5 ]. U3 z: x: w; n) Q- }, yvar vbCancel = 2; 7 V( n5 K, A/ }% y0 {
var vbInformation = 64;
/ b0 J. U; S* Y* q. H1 ivar Finished=false; ! p$ S. M% e. |4 J) p
- W# X+ Z$ M1 O( v; R$ H- u
var WSHShell = new ActiveXObject("WScript.Shell"); % S! ]$ q4 H$ @. S5 h9 k& P
- T* _# H9 e* U) avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* m {5 ~, S" Y) W
6 {& h, c" C8 v/ f3 Osimple.SetLicenseType("Runtime");
' w' d- N# y+ n, V + ]5 ~% K9 }( t. \7 d! x
try
6 O$ Z, L9 f" p# e) X5 [$ z5 w{ 0 c. R7 e A% y; `3 w9 i7 u: t
// Enter the path to a model file!
$ f/ @# Z' ~6 E7 T" s simple.LoadModel("C:\\Models\\Test.spp"); 1 v3 R* r" t8 v g2 d% @
}
. ^0 Q/ f1 S4 K2 [) u/ gcatch (e) ' d6 h& C4 k, Z
{
/ I* E' h7 v( b( p) A7 R7 P k WScript.Echo("Could not load Model!");
# T, t5 I2 M/ R- ?6 r& T) p WScript.Quit();
% C1 `$ @- n6 k} - @( V( @0 v' }3 r/ E
9 [8 a; s2 J$ i; e4 m3 Q
try V, O% G1 E& Q2 z5 T- c6 Q: R
{ $ d I* u0 r1 w. _7 v4 |- F
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
$ ?. l, X8 g% M; V% i% m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- J& A# E; u& f8 f' S2 R if (r == vbCancel) 8 H4 W& Y+ D y, f1 v
{
" I0 j' Q' z4 }* W A, z- s simple.CloseModel();
: G" ?. {) T( t WScript.Quit();
1 y6 L, i2 V. J2 L* [ }
4 D7 {0 C h" }* V8 R}
8 S* j! k8 ~" A' c: I1 d 0 ?7 F+ {% H5 m: E$ P D, }
simple.StartSimulation(".Models.Frame.EventController"); `6 y$ P1 b3 R# {4 D/ n! {
, \4 O. V3 M9 B% y1 l
if (simple.IsSimulationRunning()) 0 p8 X1 u1 q* a
WScript.Echo("Simulation is running!");
6 v: K& N' a9 J+ z" u
! z1 i. w( m3 o/ R8 G! j# M// Wait until simulation is finished 3 f- |" T, O* a
while (!Finished) WScript.Sleep(2000);
! Y& u0 x& e$ j9 j, ` ; ]0 a1 B" H/ \* h1 L2 c& e/ h
simple.CloseModel();
3 d/ W/ t0 H2 Bsimple.Quit();
4 G: @! Z! {- Z+ H6 d) }8 YWScript.Quit();
. c* p( U7 P6 T ! f( z$ D3 q0 p b7 I( I% p) w
) U% }) v; Y: ], s' S/ Y4 y& \
function RemoteControl_SimulationFinished()
& s& ^6 \+ I. D) f$ @) a{
* |+ T; H x+ a/ x5 m WScript.Echo("Simulation Finished!"); |