Example of a JScript
- M; @. C7 e' \* O8 B/ I- K: hvar vbOKCancel = 1; 3 u) t# O* w% }, j/ y& \
var vbCancel = 2; 8 }. N; j5 T! W2 x2 B
var vbInformation = 64;
$ F$ {& V l' g5 z( n9 qvar Finished=false;
; @$ I( H9 w& ^% w, E" N# v) x
: d+ j8 b' @/ P( A. j# ~var WSHShell = new ActiveXObject("WScript.Shell");
: j2 @# K7 L% ?- u
/ A% h7 A# ]+ Z s( P7 f3 Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. [; f0 k" t% C6 u6 H
+ k& l) O8 I2 x8 S( O. u. E5 _simple.SetLicenseType("Runtime"); ( u' {) o/ r, G3 j3 I7 A/ a( k# b+ p
$ m% @+ s6 q8 k) R. ^4 M m
try
; Z8 R; g G0 k{
) f/ T7 S" ^( U // Enter the path to a model file! / H" W$ x7 a9 k9 z7 U
simple.LoadModel("C:\\Models\\Test.spp");
& u+ z/ a9 q8 q3 D) M: d} , h) t& e7 o) Y( h- f, l$ W. o0 g
catch (e) / f6 S2 Y5 F3 V( c
{
( K7 u5 C/ E% r6 L WScript.Echo("Could not load Model!");
' `$ S( z7 q# ]/ K- {, t5 W WScript.Quit();
6 P8 r7 ^ v6 Q* n) U* r# Y) d}
4 J8 I( I6 E( m0 Z" N 8 Q5 p4 ~1 z, {
try
, l+ ^8 B# k8 s h( K{ 9 q2 b# X0 a% n L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: r: v3 H5 Y p; j r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% W! \. I6 O" y; L8 r- E8 \' o4 Q4 P if (r == vbCancel)
7 N" `0 c5 Y6 w9 c { : }: L; l! \% q" m
simple.CloseModel();
: f. N& M: x# V- O/ @3 m* s% m- M WScript.Quit();
) u, M, l" k. K }
% j! J2 k t2 e} 4 }) c# t! t) I6 e+ L/ H: ?$ c
1 A6 s0 {6 l' d+ B' K5 Qsimple.StartSimulation(".Models.Frame.EventController"); / j+ b* D1 w: [5 l- t+ R
' g+ d- ~! ? X2 R( z- t7 y
if (simple.IsSimulationRunning()) 1 b( D+ |2 B, D7 w6 R1 d$ u6 O) B+ m5 K
WScript.Echo("Simulation is running!"); ( o1 D) _& A! w3 m. M
% z t6 x: m2 c1 Q( w* O
// Wait until simulation is finished & Y' x" f1 A& @! g+ M* ~4 I. d9 N
while (!Finished) WScript.Sleep(2000);
" d9 l3 P) f1 d3 U5 H - q- [# h# x( E) C/ N' r
simple.CloseModel(); / l t% i; K p$ ^* f
simple.Quit(); + b& D. a6 J6 \5 g
WScript.Quit(); ?+ e. n/ J% d5 K* C+ s
) w" b# C' f$ S5 o: y3 g( m
+ X% {: h0 E+ C; d1 Ffunction RemoteControl_SimulationFinished()
; Z. F' U* E" m+ W8 d. F{
' M3 T% P$ C. k2 @% e& h& c c WScript.Echo("Simulation Finished!"); |