Example of a JScript
- X1 G o b2 J1 zvar vbOKCancel = 1; ( y) n3 I7 r1 Q F
var vbCancel = 2; % F. }2 r% }# B4 L( t! d% t" L
var vbInformation = 64;
E' v+ G! \. C0 r, s; d0 ?var Finished=false; 5 T8 @# N5 ]% |9 d# A8 \
1 }/ w/ i2 o. p1 o; G' Cvar WSHShell = new ActiveXObject("WScript.Shell"); 4 G( z$ `( c$ z" P/ l
0 L; E9 @% f) u" f P) ~( T8 }" [) G
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); " K; E: I. A* k6 k+ G2 }, W
' c/ S6 C8 X1 D3 C
simple.SetLicenseType("Runtime");
& n( p# A4 m3 I1 E: J2 f
0 ~% ~5 i6 s, E! v" s9 Q0 V' ttry 8 X" @# ]6 K0 [1 H8 m/ m! i
{
$ f, B G+ r6 G7 n2 q2 }5 L+ \' c // Enter the path to a model file!
$ B) i" x! M8 `$ [ simple.LoadModel("C:\\Models\\Test.spp");
; W% q) ~3 N5 N9 p3 x% S} ; `3 m) E: d4 @4 t; H( X
catch (e)
2 ?& c4 O' V$ E0 Z# \. J4 S" a{
* V! x, \' _# ~4 A6 ?/ T# m7 e WScript.Echo("Could not load Model!"); - d) F W+ [, K( r, D1 C! {
WScript.Quit(); 0 v7 X3 a' i) ?0 p2 B! \
} ! I7 F" _5 D. T& x$ K
# u1 g/ t( D9 w5 Ttry 6 F- R& s' g/ L" f) O. |. q
{ ! H, [0 G; T' x. O# W1 q) ?
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! I! S8 M0 |. h2 o) g& |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : l0 b+ t3 V) F6 {. U
if (r == vbCancel) 3 L; ` L- z9 p! r8 s. x0 S
{ , [; N" ]1 ^" [5 E! H0 G
simple.CloseModel(); , c, W) g) g* Q
WScript.Quit(); / x K8 B W" ?$ D
} ( l/ P; i; J" z' s4 t
} ) P- z6 w- K- v$ U
# \% }4 j' N- y9 `9 a2 E5 g* U6 B
simple.StartSimulation(".Models.Frame.EventController"); 2 V" f: C5 h/ N9 T7 ]
, g/ V& b1 @- X. q% D7 @/ \
if (simple.IsSimulationRunning()) 9 h1 L& i# b: j, b/ Z$ ?# f7 c2 d
WScript.Echo("Simulation is running!"); 9 P* M9 a3 s+ i+ W& r' X" Z' v( c
8 w: r( u$ S+ X0 T
// Wait until simulation is finished $ ~" E/ ^( o$ x% a$ Q, k
while (!Finished) WScript.Sleep(2000);
9 o& P; B; K6 @, L2 I5 M/ g8 W
( n; q) Q& ?# h" d& ssimple.CloseModel(); # ]) l5 ?' }. g' C, P i, }. s S
simple.Quit();
* Y+ M0 u, v6 n+ j1 O- ?+ Q" C5 TWScript.Quit(); % n8 r% c3 x1 k1 U
3 A* p. R- s9 r+ N3 P! U" ~
/ W& P$ Z7 F7 m+ E' z/ M
function RemoteControl_SimulationFinished()
; C/ ^& k! w1 T$ p; J% }{ 2 Y# U" u! B2 }4 z9 B9 Z
WScript.Echo("Simulation Finished!"); |