Example of a JScript
6 E9 k3 b5 Y2 Dvar vbOKCancel = 1; 6 V' h0 q9 Q3 ?7 a% p! W, X
var vbCancel = 2;
# d1 m/ z8 h: h. n! wvar vbInformation = 64;
% B: W: g- B* tvar Finished=false;
3 |7 i L* P7 x/ Y3 s" O 4 j* d6 T1 J- t3 e7 G$ H
var WSHShell = new ActiveXObject("WScript.Shell");
7 h& Y; Y8 X/ h n5 e% Q; M1 D9 D7 i$ [$ c ( ]0 E; q' ]2 G& s* b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
, U3 f" Y2 A3 e9 z- c
- k5 B w) a' ^# t3 g# [simple.SetLicenseType("Runtime");
- r0 f- z9 e( R( T* x5 i
, p/ H; Q* R- s) Q2 f! E; C* I2 ^try
. V2 i& t6 _* b3 n3 D# ~ `{ 2 f3 R5 A* T4 z( a" U4 @( c/ X+ }
// Enter the path to a model file! ) q' Z5 }3 q: y$ ?& U! G' B7 ?
simple.LoadModel("C:\\Models\\Test.spp");
9 Y7 S) j* ~; Y5 I} 8 A0 ~$ v( {# ^1 J
catch (e)
2 {2 u' d& {, O: |: }$ }( `8 y{ + L- [8 M' Z7 Z$ B9 h! y/ g
WScript.Echo("Could not load Model!"); : ~5 }& H, m8 o" D7 A
WScript.Quit();
1 C& @" ~2 ?2 p i}
, g2 h7 z* K2 x / I# R, F; t( Y% n# c7 m
try
" j7 W0 p: R+ ]$ C5 r0 j4 n! X2 b7 F{ " J" \' k8 t8 Z( H
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 k; p8 W. [8 `+ t. C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
^! m5 G+ T: ]- Z" z2 j if (r == vbCancel) - _4 r( z( A8 Y$ g2 ?) N9 S0 k
{ & @' J! @" m1 H$ l
simple.CloseModel();
( a: W* H2 {2 T WScript.Quit();
9 O( G( l( |& }0 X& V } 3 }9 X4 J3 W4 } Z( R
}
8 c W' B4 v3 |& h
( ]$ r3 w9 E. [2 |simple.StartSimulation(".Models.Frame.EventController"); * x3 _3 F1 z' i3 V4 B$ ~0 J
# ]3 Z) K9 R0 M$ f- nif (simple.IsSimulationRunning())
$ q2 I8 l( Q0 _0 E WScript.Echo("Simulation is running!");
" H0 Z$ w, e: n! |% ]" F6 l: q: v
- ]$ ?. L) M, s; m7 i// Wait until simulation is finished : l4 d" s' a; X6 V6 Y* Z; C; i3 H
while (!Finished) WScript.Sleep(2000);
2 R1 |0 C# ^4 d/ j/ O7 G 4 ?- M& ~- r* d$ Q" w
simple.CloseModel();
( |1 J8 D, B- n K6 I9 Ssimple.Quit(); / Y' Y; ?, K9 l4 Z& _" u; i( Z
WScript.Quit();
2 q: f) Q( g# O2 d
( L* X1 g$ ~5 E$ g% F1 T) R N 0 p4 ~* R6 \) r
function RemoteControl_SimulationFinished() & f! ]% Q! ]) K. Q0 t
{
6 W" }& J4 q4 e2 d WScript.Echo("Simulation Finished!"); |