Example of a JScript 0 L- C! Z* s% ]$ R! Q3 u! x) o
var vbOKCancel = 1;
- I1 ?9 w/ Q2 W' y& E& f: Uvar vbCancel = 2;
; S- E8 F8 ~+ n5 e2 E/ \var vbInformation = 64;
. G5 ?7 v, Z7 k$ y6 u3 rvar Finished=false;
# S' N$ U4 u: a% z* I) |! p2 f0 m
# V, d8 a4 m: X. F9 {) [var WSHShell = new ActiveXObject("WScript.Shell"); * c1 a& i5 ~; K) d/ t c3 Q7 E9 b( l
, h* O/ @6 {$ e+ W: Z5 e: R) `var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
1 e9 N# @5 ~$ h0 Z
, `, |/ `# l7 R: ^3 \, csimple.SetLicenseType("Runtime"); " {1 o; a8 I# \& [8 s
9 K# O p$ P' Q# } ntry + W' [3 q$ p% |% Q3 d1 @: j
{
. q7 W$ n+ n9 a$ _/ z // Enter the path to a model file!
" O$ g1 e5 H6 E( i: G simple.LoadModel("C:\\Models\\Test.spp"); + R+ G1 {& A$ a& l; _
}
2 l: G3 Q7 ~' u7 ?0 t' Fcatch (e)
( V6 A* y: n( B6 L7 t{ 2 Z$ e; q$ L. u( d* ^: y( W
WScript.Echo("Could not load Model!"); + x w+ I! U: y; G
WScript.Quit(); % B* i& x& B! @: ?
} " K. R$ W* o7 e/ |- ~6 f8 y
4 ?3 D ~: d( [( i G- a
try
8 }9 k& x2 T3 }+ U, g0 B{ 7 N0 O' |. {7 P$ A6 K- _
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ z& Y6 f1 [, t' P+ m r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & t* h1 a6 e6 q7 ]3 F
if (r == vbCancel) 5 c2 r/ b7 ? ~+ r: u
{
9 x$ v6 w9 a' [$ R simple.CloseModel(); * a) B8 [" |6 r! d8 Y
WScript.Quit(); * K) g% t* J) _. Y' {# H1 Q4 v
} . k6 Q' n7 W( N( p# O. c
} 7 t/ k I8 a9 [, c/ J' Z) p5 L
$ l# x) V( l3 n6 g3 [
simple.StartSimulation(".Models.Frame.EventController"); 3 \" W) Q* x- M) L
) L2 G" E5 ]2 x1 P4 Fif (simple.IsSimulationRunning())
' z: B$ q" O4 ]* x+ Q WScript.Echo("Simulation is running!");
1 n: }) M" v2 S2 z " h# \$ ?: O) C: }
// Wait until simulation is finished
! f- r/ J9 H2 Q; A# \/ Ywhile (!Finished) WScript.Sleep(2000); ; T) ?$ r( P4 y( `8 o. O, R
- V, R- \6 c% h: f9 \8 z. d+ Fsimple.CloseModel(); ; j! F8 X* P% |, M7 u, Q
simple.Quit();
" L# g% S. Q1 Q# t. p; {% KWScript.Quit();
& g- U0 P, g [- W( h7 [% j 0 G5 D3 d. }. q3 ^ ^! }* _. w
9 ? V2 J) S+ |7 x" z$ }1 [
function RemoteControl_SimulationFinished() 2 D4 v# F _2 b: a$ ~* }# c3 @
{ 3 G' X7 |# ^+ G% e* d2 A
WScript.Echo("Simulation Finished!"); |