Example of a JScript 7 {1 p3 [8 A* r/ D H
var vbOKCancel = 1;
2 `9 s4 u# B# [4 c0 {+ Evar vbCancel = 2; . ^7 U+ Z( ?5 L R0 P( g1 k! c3 a+ V, @
var vbInformation = 64; $ J9 s* z4 k- { `& q
var Finished=false; % P' N# [ ?' Q7 j
2 @8 h# {" B/ h0 f3 N
var WSHShell = new ActiveXObject("WScript.Shell");
e7 ^' n* F n+ s7 q
/ y) o/ U: q& `. \! `/ Cvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # R' k: y- p. V$ h
9 r- K( C5 E. U2 w, \! Osimple.SetLicenseType("Runtime"); . l7 e# u* x3 w& y2 u) T) Q5 d5 Z/ K
1 N( _/ R! Q- V( q+ X- j2 r
try 3 b {6 F* v; E
{
. h$ [9 W0 I) w- n6 z6 P // Enter the path to a model file!
0 d$ T. c* ^, H! I' c) P- U9 K simple.LoadModel("C:\\Models\\Test.spp"); : I. [$ r% P- `& X/ C) b1 ?
} ) U2 c( Y# t" t9 W
catch (e) : [; t( ^$ C6 |8 X; L+ x+ X
{
3 j/ i9 [2 {5 }* i, q+ g WScript.Echo("Could not load Model!"); ' m) W9 L6 w/ e# ]0 o' V
WScript.Quit(); 1 D4 C3 j. V% H. y7 Z, Q
} . r* e+ r' A# ^: d& p2 o2 P
; {5 u3 S: n, B4 W/ V' g9 B
try T6 V* ^# A$ G% k- H4 y
{
1 R$ J/ s7 F5 y4 n, e# y; |+ e5 P simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 V& v0 j9 j6 W! D5 }: G4 u
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! C9 Y6 [: {3 R2 f if (r == vbCancel) ( j1 @! k- R7 i u
{ / I4 ^4 h6 F% h- \. h8 a
simple.CloseModel();
# F, n: l1 |( n, i6 Z A3 @" J# H WScript.Quit();
3 x+ X# z' X8 Z' {, N: } }
. M' n$ g- i( X* A) y" x6 i+ M$ [} , q- @4 P" H [- h
9 F" }3 Y( d5 o3 I8 C8 q& a) ]simple.StartSimulation(".Models.Frame.EventController"); - S( H1 T- I! {$ F, F: o( [
/ W) W2 P8 ]; B7 D( ~/ D% W
if (simple.IsSimulationRunning()) 6 k) i) u4 u% ]" {4 i, o( l1 `
WScript.Echo("Simulation is running!");
8 N6 S; w3 c1 s- w( ^# E ; H p" c8 ?! @' q! T! \
// Wait until simulation is finished ; ] v5 j+ m/ e( L( b
while (!Finished) WScript.Sleep(2000); * S3 P% w$ w3 U3 N& k; R4 B
! K8 n1 a1 z5 ~# ] W, ]0 `. g
simple.CloseModel();
& k. n1 l9 J7 B% Q( I8 \ D& Q# f. Gsimple.Quit(); - V: `4 Y. l( @% i& \/ ]! i
WScript.Quit();
, {6 r: Y$ _6 d
! Q! s: m2 K& V # p! } k: f2 b% d
function RemoteControl_SimulationFinished() ! ~3 N0 w# B b
{ 7 g- I, G+ l2 u" H% c
WScript.Echo("Simulation Finished!"); |