Example of a JScript ' j" [0 x1 ~2 n9 h, O6 W4 u
var vbOKCancel = 1;
3 v- M) g4 {/ L9 T/ cvar vbCancel = 2; 0 L$ T- w" N' l K
var vbInformation = 64; / n5 Q% W4 C- H2 o) K, V
var Finished=false;
% x- a2 o4 V8 r$ T* \' M% r3 T; R% Q4 o
. K( e1 ]8 d4 q- [- T9 m- |var WSHShell = new ActiveXObject("WScript.Shell");
- l% Q) }3 G: b5 e2 x5 f. s w: N- ^
/ Z8 v2 r9 Y: m& avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + n% W9 ^/ m3 u& g4 @( L1 I
+ x3 W4 z1 @1 M4 x+ ~simple.SetLicenseType("Runtime"); P4 ]3 a: u7 i6 y' P
$ W; [# o5 j3 b
try ) V' z' G2 j* f0 m( ~& c+ \
{ ( M9 q `8 l/ d! B
// Enter the path to a model file!
- N0 L8 x& G: Y y* ^3 [ simple.LoadModel("C:\\Models\\Test.spp");
+ o9 C$ }' z& S} ( R# M5 m9 }3 T' ]7 ?
catch (e)
2 f/ E% ^. A% n G- }{
b- G6 _ ^2 R2 P+ V WScript.Echo("Could not load Model!"); 1 x1 K/ ]: N& ^+ j, u3 u8 N
WScript.Quit(); 1 x- @: f0 @/ q( ^' ?3 ]" @# r6 Z8 p% I
} ; G8 K: a% W5 B% g( V- G V
: T: s* p- c4 y5 |5 B8 Etry
9 J8 f1 `5 } P- l{ + { M6 k- V( a @# [' u
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 X" n" a) P- Y3 W9 N% G: y+ n r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ; s. j# \: i1 I9 \$ u0 j- w# c2 [
if (r == vbCancel) % `: o9 u3 l# |4 k& g' x6 j! t& F
{ - c: B1 G5 R6 t9 r: b, _9 G a
simple.CloseModel(); ; m$ f: l/ k2 C. Q6 c) r
WScript.Quit();
4 `3 C" k" `* E" [4 o* J } : D3 A2 q1 k; Z3 D& w# W: Y: F% U5 m
} 4 |5 ^( l2 Q' C2 a1 X4 r
) X/ o9 r6 e/ t0 _: F2 Jsimple.StartSimulation(".Models.Frame.EventController"); , f+ R& v6 L. c9 n$ d- \
3 ]. q0 ?1 Q: z2 d+ N; p8 r
if (simple.IsSimulationRunning()) # b5 j+ p) h1 d) ?8 E" q
WScript.Echo("Simulation is running!");
! K4 @+ x& N+ L
+ @# h! n; D2 t5 J// Wait until simulation is finished ( K3 Q- i0 `: L2 T U, G$ ]( m- i
while (!Finished) WScript.Sleep(2000);
# c9 S+ w4 \6 B6 }% l! o/ k
0 s4 a/ K4 Y8 p1 x0 M6 S+ [simple.CloseModel();
9 P; U) V, s2 r5 ]simple.Quit(); % K* y6 m7 T4 e+ I3 f( s6 _
WScript.Quit(); ( G$ ?4 C2 E0 F" H
4 }9 r: ^+ R- l- f. U9 c& M % H) |/ g L% |* X U8 q/ l
function RemoteControl_SimulationFinished()
: I; u- V/ ?9 ?! M p3 ?6 z5 w4 D{
" ^; X1 W7 T; J9 K0 h. ]7 e7 f. W WScript.Echo("Simulation Finished!"); |