Example of a JScript - C' A! J3 [, m J9 d
var vbOKCancel = 1; 8 _7 Z# C8 x9 j; O, w+ t
var vbCancel = 2; 1 V* ? Q f2 n+ ^) F5 S9 o5 L: ^
var vbInformation = 64; ; d! V B8 O( ]8 Q( c2 }
var Finished=false;
" M3 _4 L2 I! c' E + ?" D; W: m+ y
var WSHShell = new ActiveXObject("WScript.Shell"); 5 [/ m4 V" }& V5 Q% b" N
H; S; I" q! R) m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
* @- u* q& y/ ]+ M& K1 w+ Y; x) T
+ Z c) C; J5 c! |/ F/ s$ Z& psimple.SetLicenseType("Runtime");
; ~! }) `8 V) r" \7 V8 x @0 Z# l$ m5 p
try
0 l0 J' x# @ l/ j" @( i' ^{
8 K0 A7 w) U1 q% U6 l0 G7 G' a2 Z // Enter the path to a model file! 9 m% V. H9 w9 ^
simple.LoadModel("C:\\Models\\Test.spp");
# s8 p3 j9 M1 q6 d( B4 ^}
9 i! K% X- T, Vcatch (e) ) U6 n) [( A+ N6 Y! E
{
' M/ M; D0 n1 o WScript.Echo("Could not load Model!");
3 _/ v* D/ c6 ^& J WScript.Quit(); % C; A4 r' }, e9 `3 p6 r
} : N' V5 E" Q; r6 A I1 ^
6 X- I% f: r" n0 `4 Etry : w% n3 U+ s( C" A
{
: e# [! M9 P5 H' w3 Q simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
" e# L) n& j) ?8 k; f8 d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); * j3 U/ ?/ f6 }% |- j/ B0 s6 u8 _9 S
if (r == vbCancel) , X, z' S! k& n( I6 |3 J0 N
{ ; W3 c5 j0 y+ y3 g+ c! Y& z! z
simple.CloseModel(); 3 v; Z1 V1 O8 h3 s/ A
WScript.Quit();
: {" A6 g5 H- t8 ] }
% X; j/ z" @4 v |& @% R} : Z f; S" J. H) v
$ }) t/ ?/ n2 u( q% Z
simple.StartSimulation(".Models.Frame.EventController"); + a; ]1 T) T* J+ F& f3 a, c# L; Z
+ u8 o: L) }: S# k0 K& f
if (simple.IsSimulationRunning())
5 x2 ~5 w- B& p) e WScript.Echo("Simulation is running!"); 1 y- B; X! V. I
% A5 _; `4 k) u: S// Wait until simulation is finished
- j( C& G( U' F" C# @& Wwhile (!Finished) WScript.Sleep(2000);
1 d7 F6 |. R' s$ u/ f+ u & l) {: V- F% I, O% f0 g+ W
simple.CloseModel(); $ ] V/ d6 A. V" I
simple.Quit();
]# A9 F+ J0 z4 d N+ t( RWScript.Quit();
' P) b& |) q$ s. |
- I8 t) c. l4 v $ {6 R- I" j9 g$ |3 O: H
function RemoteControl_SimulationFinished()
" x. L/ x; ^) M" V) H- j- Y+ _{ / R1 g, S+ s3 f# @* ^
WScript.Echo("Simulation Finished!"); |