Example of a JScript 3 T/ a. v% ^* [0 C; H7 c
var vbOKCancel = 1; 9 a! Y9 e8 N. L; Y0 {
var vbCancel = 2; 3 p. H* a# e% x
var vbInformation = 64;
! Y$ a, @' S0 jvar Finished=false; 4 F8 f0 F* V% n8 U R* E# ]; H
, B1 E6 X/ r$ Qvar WSHShell = new ActiveXObject("WScript.Shell");
! q( q0 O" X1 u( d8 D r 9 @8 |( d- s& V) W( b( S- D% N
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 3 l( a: w$ J: \/ G; X( |! S: {( h
, c& _3 g: X. E( E5 Q6 J- F5 @simple.SetLicenseType("Runtime");
; h R4 @6 `" |+ W- F: v# ^4 e/ v# d# L
) P9 x, D$ m8 W j' G2 mtry " l4 Z0 q+ f# _$ w9 w) F
{ 7 G! @. T$ H' R/ E- i+ t
// Enter the path to a model file!
& r3 X3 B8 @* d simple.LoadModel("C:\\Models\\Test.spp");
, l9 Y- L1 t& Q/ j. E# w: J} : z4 |9 i5 @$ K. P2 a8 z
catch (e) 7 K" |, R% n, P! @9 w' h( _
{ 6 R) _/ L! o2 _" J! s& a( S
WScript.Echo("Could not load Model!"); % Z2 E! X( e( Q( ^: ^* d) h
WScript.Quit();
5 P( V, z& s- g9 Q0 ~} ! d0 D* S0 d2 y6 K. c; e4 K# L
& Z5 j$ q9 I* Y8 W# ktry
/ x2 V! `$ A6 y& v- s' X( C( G8 C{ ) T, A7 C$ A0 I$ D# }9 Z0 f. ~
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
( g# q8 i& U% r: _" k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : q' H7 u0 s% L3 I( m
if (r == vbCancel)
# I8 F% H' G: Z& U3 M {
; w% O0 W- }( D7 E4 N% v simple.CloseModel(); 0 G, Q" y$ b2 a2 [% n1 b
WScript.Quit();
) {6 H" E* w% e, `) w6 u3 w& b } : j C7 C$ D, c- N X) ^; P$ T
}
. ~- w$ N5 u, l- V) j- j1 E9 B
, p: \, x; r' X" ^" C7 msimple.StartSimulation(".Models.Frame.EventController"); + C# y1 I$ i# m4 h
q( I" [* \! ^$ c
if (simple.IsSimulationRunning()) * x# m1 Y, x) F" f" x; f, }) k
WScript.Echo("Simulation is running!"); : |4 z; t6 D" b1 u2 C0 u
/ s6 P. e4 G9 k ]" O: A
// Wait until simulation is finished ( x; p2 p/ A' D6 r* A8 U- p
while (!Finished) WScript.Sleep(2000);
: u. G( b$ A! c# ~% S0 H ! B0 `' W/ h* q. l6 x5 D1 [
simple.CloseModel();
" V$ l5 B& u3 S& F& rsimple.Quit();
4 r% w+ T' F5 C: fWScript.Quit();
- [1 L) @6 b7 V
) R) D. E4 C ]- W2 G ?: t ) |6 a5 o) B# o3 Q
function RemoteControl_SimulationFinished() 3 k2 ~ h+ \- p) k& A" U3 r, y
{ * e4 X) k6 f* _ L
WScript.Echo("Simulation Finished!"); |