Example of a JScript
- }& h" H) u# E! u, E( vvar vbOKCancel = 1;
" U9 i" R; e! E5 vvar vbCancel = 2; # Y" _8 W! r" S' ^# ?
var vbInformation = 64;
2 Q- F8 j- r; H' }2 V4 ]0 a+ evar Finished=false;
2 a J. B7 {6 t% L) q* C
* I4 b1 G( |. A/ f9 Q& T1 Uvar WSHShell = new ActiveXObject("WScript.Shell");
' P: i$ B7 \; F: N3 b* E9 I& g
" C) i" s( U( Nvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 e4 F# w# q9 V9 I$ ~ 5 \5 d/ R7 ^! {) w; m/ M: X
simple.SetLicenseType("Runtime");
. q" `, Q W% \% |7 e" [
3 ^1 C! H }3 b. H$ V) \! Z% M9 {try
8 B7 y9 j* J4 G{ 0 M& y$ ]* Q, V7 q
// Enter the path to a model file!
. V& ~8 O( D; v simple.LoadModel("C:\\Models\\Test.spp"); . c: e: _8 ^! v, _2 p0 [: _% R
} 4 e* \# E* N$ H/ a6 W2 q1 p* g
catch (e) ! ^; X$ | x" W& s' t
{ ; Y# u! M. Y$ s& @- ^/ w2 F2 L
WScript.Echo("Could not load Model!");
8 t, \& v( w* B- V; ~ WScript.Quit(); 7 N" s1 B# _7 T8 \* F
} 7 B% T4 Z, {6 i: e: [7 i
' q5 b# ]& G+ ]* m. ztry 0 D. J) E" n, F2 K4 e. f
{
' J9 q% S+ j0 m simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 2 g/ X3 ^0 [: w8 c( B
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
' B9 ~, r% X, a# p. D, v if (r == vbCancel) % `7 i* J0 F) P, m% t5 D# z- [
{ + v3 v/ d' ], Z( U" }$ k4 R4 l
simple.CloseModel();
. f6 b9 z7 b3 Q4 M. s WScript.Quit(); + z/ X6 c+ c" k/ L- S/ j0 w
} 3 k0 z; U) D7 L9 ~" R
}
* b$ I% o5 E% L2 v: O t+ d" N 1 w/ Z1 C0 I$ V5 ~2 N
simple.StartSimulation(".Models.Frame.EventController");
/ ~$ e; Y/ k0 h2 @ 9 T- p9 r6 y z7 V! r
if (simple.IsSimulationRunning()) 7 A1 a* N. `& g V: w5 i
WScript.Echo("Simulation is running!"); ! w5 e8 r, C( O! _) V
: @/ H4 ^# k5 U// Wait until simulation is finished , s+ {/ U0 E! A+ {9 x
while (!Finished) WScript.Sleep(2000);
/ {6 |( t+ k* B* g! f8 y6 V( Y2 W* C & c! y0 W6 f+ B/ f) \
simple.CloseModel(); 4 o7 z0 x9 m! [% w) v
simple.Quit();
, a8 [! K% a: r/ k0 |WScript.Quit();
* v! A: I2 A* o 3 Z7 ]% [6 \" ^& H& t2 {* |; t
7 W* z* y+ J. H) L
function RemoteControl_SimulationFinished()
) r5 `( I7 w5 ?{ 8 L* g% C" f1 d k% y) H
WScript.Echo("Simulation Finished!"); |