Example of a JScript
2 o, ~& {; b5 V. H C- ]var vbOKCancel = 1;
2 l% }; |) L; g5 r! ^var vbCancel = 2;
. N1 Y4 \' _% Yvar vbInformation = 64; ' Y5 j, c" e* l6 q4 O! H
var Finished=false;
, D3 q3 G+ b+ e) ~
( _9 ?8 r% _% ^- Z; yvar WSHShell = new ActiveXObject("WScript.Shell");
1 s% N3 r8 u7 ~; a2 z% z
" f1 R0 e4 g$ ]+ U2 Q# s# Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " o0 F4 B$ U# I V4 q
/ l- I+ R8 ^9 O& g( [simple.SetLicenseType("Runtime"); ; |, ^) L$ s; O
) J2 S* U5 Z3 C: o {% R. Y
try $ N5 d( \0 f8 \ N
{
* q9 F& o# Y% X5 m2 L2 f // Enter the path to a model file! ( j+ m% Y$ a0 p/ y3 p: L. |
simple.LoadModel("C:\\Models\\Test.spp"); + L# z( J8 P! F$ c2 M& N
}
' a* K8 G3 L( O% b1 mcatch (e)
G& g7 x" f6 \) b* J* I9 F6 k{
) u* y, x; v; G6 I* z, J WScript.Echo("Could not load Model!");
; q: |* `: `- @6 f+ N: p1 V WScript.Quit(); 9 |+ A/ U+ p" r
}
1 K8 V% h6 k1 C# E1 ?' k
) o: d0 A1 w; C6 jtry
7 Z! }' u V I+ d) t' N{
$ ?; J0 H6 U& B$ d simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 7 n; [7 \# A, Q; I- P
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); , @. b5 e+ ?4 K) ]0 |" I
if (r == vbCancel)
- k9 H3 s1 r- S/ _: x, l { # S. Y! A: P; U$ a
simple.CloseModel(); + B' y0 X7 m3 N- Z
WScript.Quit();
9 ~+ ]' z m+ n; g1 i }
4 L; Q7 ?& L. a9 q& E! G} 5 A4 A( z% g0 o/ d
1 |- R: N+ @9 \1 y, {6 O( `% T
simple.StartSimulation(".Models.Frame.EventController");
4 O; U k6 O$ D% B
4 n( V' k) ]+ d5 X: [1 nif (simple.IsSimulationRunning()) / k! R; \4 {; ]
WScript.Echo("Simulation is running!");
3 }& \9 U! b: M5 O0 ~& o& L2 _
9 @( t; i, @/ x* q$ x8 M// Wait until simulation is finished ! Q8 T' l* P: U* X% T
while (!Finished) WScript.Sleep(2000); 2 p! B7 g0 g) E( V3 i$ P% h' l6 H
" P) I* `$ s* s7 W! o8 Q: b
simple.CloseModel(); 9 a% I! @. f, l6 B4 C
simple.Quit(); % U5 \3 s' D8 k- I' e
WScript.Quit(); 8 l( K8 `& U! m A Q8 R
+ T0 p% ~: V: s6 z5 a
+ J/ F% @) M1 Z( a
function RemoteControl_SimulationFinished() + h+ H" B1 ]) g. \
{ ! t1 H6 O3 k6 S5 ]
WScript.Echo("Simulation Finished!"); |