Example of a JScript 2 C, W+ z! X' O W: x6 {1 x" W
var vbOKCancel = 1; 0 S9 C1 z* E& k [- h
var vbCancel = 2; ) h( b) d Z; ~ D5 \7 c
var vbInformation = 64; 3 x( d" G; E, R1 i1 C/ J
var Finished=false;
( t. t/ D' T- S* d9 ]/ t
# |7 Q' e+ c& o# c; Rvar WSHShell = new ActiveXObject("WScript.Shell"); 4 h# U! [0 z; y$ X$ l
2 j- t+ O4 }$ nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * s' m' P# P; j+ e1 N
1 i7 d5 j3 p5 }+ msimple.SetLicenseType("Runtime"); 4 w, D- Y1 V$ c& e4 R0 n
) B8 ^+ y) A" d, p, w
try 2 N% h% N6 U' z- w# a- z
{
- f9 p, T8 E% a( ]5 z8 q3 m" E // Enter the path to a model file!
8 j( @* x: I( b simple.LoadModel("C:\\Models\\Test.spp");
: \4 O1 M& k1 L}
9 `* E$ S% q C8 ?4 p# h2 Vcatch (e)
5 \* i2 @0 q, {( v# p; |{ 1 n: \, @# E3 a: o: ~( ~
WScript.Echo("Could not load Model!"); 0 }) E i3 R/ C! b ~! n. h
WScript.Quit(); # z. m4 _ z, f- J! G' H% H
}
; E: S; G. P& E0 W
7 K% `6 _2 Z# w4 }0 u7 P& dtry % m6 L& }# n: Z) Z/ K
{
5 d2 o/ F4 c+ Q0 A simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
4 e7 z& J; Z+ U1 W& K r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! Q+ F3 W1 f; j* `( _: K; r7 Q
if (r == vbCancel)
, [+ b! s$ c% D( ]- G4 M {
8 _( T3 f# s+ A- H. U: R+ u" A; | simple.CloseModel();
. ~+ m+ z( n+ L# S+ {5 L WScript.Quit(); ' m8 t; P2 m; C4 D' ~ L: @) ^, V5 h
}
% Z/ z- z0 M7 g+ {* o( e}
% K5 M# K3 z E8 p9 x 6 }! D: q9 B* N
simple.StartSimulation(".Models.Frame.EventController");
8 t" O& {+ L2 E" s: f8 o
( \8 m; f. J, S I" Y/ F! D! kif (simple.IsSimulationRunning()) . x$ k+ z5 s" T5 N6 Z
WScript.Echo("Simulation is running!"); # j. C* G* S% p& S9 m
: D) f) t; r1 I1 q! o) S& a) G3 M// Wait until simulation is finished G5 [4 ^$ u- |) s2 `
while (!Finished) WScript.Sleep(2000); 7 D7 l) |5 \# }% r$ C9 A5 I) B
+ B2 ]% Q( o o" e& `
simple.CloseModel(); " Q) N* Q7 j! A
simple.Quit();
' v6 S! z6 e9 z( yWScript.Quit();
7 a# u ] _6 Z" t5 D
: g! t# s1 H- [
( a4 C- {* V- Z' Z( xfunction RemoteControl_SimulationFinished()
" ^0 u8 j# S" ^. K{ / H" ~8 A6 k& v3 S
WScript.Echo("Simulation Finished!"); |