Example of a JScript
7 `. q9 r. T: v+ C' d$ vvar vbOKCancel = 1; 6 Z$ J2 [9 a, i7 V
var vbCancel = 2; 8 L) k# {/ v, [
var vbInformation = 64; 6 v) c; ~4 a+ V, S- i: F
var Finished=false; 2 u K, `0 F. ^( n
) t! I& P( d- W; r [var WSHShell = new ActiveXObject("WScript.Shell");
% W* k* L$ I; l6 [
9 K9 h+ y6 M9 ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
- ^& s* J! A0 |2 J) K+ A% {8 J1 C
5 G/ z2 K- M) \4 Isimple.SetLicenseType("Runtime"); ( e; E0 O& G% m4 r4 [, B* g
2 q: x: o, @3 \' \1 x9 S2 n7 D
try + ]6 s5 ~) v) v+ L; G8 ~3 O& f
{
; f1 r( W. L4 L/ h8 \ // Enter the path to a model file! % E) G; C9 s6 A& B4 M$ t' ^
simple.LoadModel("C:\\Models\\Test.spp");
! W- f) c9 Y$ ~# ]: z} , W H4 o6 m9 b' D7 Y
catch (e)
* n1 ^# g- ~* h! ^4 P5 u6 X, H! q{
; p+ V t% A! S0 h+ o' O& G WScript.Echo("Could not load Model!");
: d d8 {; \! T0 P, d" y6 S" h WScript.Quit(); 4 }" X% @) q z. [1 l: t: |! p
}
" K0 l/ L7 |0 J" f
4 c' I6 ]) v! stry , p+ M: k2 D% x$ x( A
{ / A& ?" I& ?% p! v: R5 i6 y- f i! c
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 r1 K- U3 O# W8 ^$ n: z r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 8 N9 B9 A/ l8 B% f8 g+ Z5 ~
if (r == vbCancel) 6 [& }7 a0 q$ C
{
- p+ y+ t7 h( H& m" c- v simple.CloseModel();
4 ]0 F7 H" t x3 {9 V6 n WScript.Quit();
. A/ p3 b9 t" o- O/ O } / X4 C$ D B8 |! b1 G1 T& V
} " O; c) B0 x( G2 G# I0 V5 }: Q
( D# @- d7 X: [; }! l! ssimple.StartSimulation(".Models.Frame.EventController");
5 K! U4 M; ^5 |! m2 Q3 S9 s 0 F* k4 A/ i/ D( e8 M+ A( y7 s# p
if (simple.IsSimulationRunning()) # a" ^2 ^) ?( t
WScript.Echo("Simulation is running!"); ' G0 c, L! c. u! x' F2 {
9 o3 E' R# [: X0 K
// Wait until simulation is finished 7 e: E7 a( o$ R, n
while (!Finished) WScript.Sleep(2000); - u* J% z' o! W% i0 k4 b
# I) T( A' A, \& t) {$ [; c! v
simple.CloseModel(); * K; M! j* {6 J0 ?9 X
simple.Quit();
! ?4 d4 e) g8 i. C! gWScript.Quit();
0 G4 j7 T. {3 ` W1 G 3 j- D! i% Y( o9 S# ^
, ^( ~ d' Z' G+ ^6 h- q& A
function RemoteControl_SimulationFinished() 9 X1 D9 F4 s9 \/ Z6 Z
{
' R" Z2 H; A: C1 O$ @0 I+ p# x WScript.Echo("Simulation Finished!"); |