Example of a JScript ( L: T, P5 D& j* y. R
var vbOKCancel = 1;
( B8 I) m h7 ?6 Vvar vbCancel = 2;
6 @( X) `+ L/ |var vbInformation = 64; - t9 T% \$ h, d9 m" b0 D- |
var Finished=false;
. I1 R& j9 w$ q" ~' }
2 O) S2 c- i1 R; R3 w1 |var WSHShell = new ActiveXObject("WScript.Shell");
: R/ b5 O! i/ X. j$ T1 L6 t0 K# C ) g6 G' y5 {; l! `9 d* l; q
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 n* q1 ?# q9 @9 ~ z ( T* v) M, @! b% u% l2 p
simple.SetLicenseType("Runtime"); 8 v" u$ J8 e4 I3 b7 K
8 Q0 O3 x" D1 ?$ h0 r& s8 X
try ; x; R; g( o3 \* S' {
{ / m, Q# v k! l; k( z
// Enter the path to a model file!
. f# N! o7 D' A+ K simple.LoadModel("C:\\Models\\Test.spp"); / C% j+ a; |! _! Y! U+ E. \- g4 {
}
2 n. \8 D( Q/ W2 b9 ^$ scatch (e) 0 N5 G$ k4 U: B7 _6 e
{ - p4 E2 z) n) J8 P) }
WScript.Echo("Could not load Model!");
* K& K# p# Z* a% \ WScript.Quit();
- L& a) R4 u& S: N% o. z} 9 `3 l" q# W2 B9 T2 A
& h7 i& _# W5 f! }. v* Wtry K: t( B3 s7 R! g" |. z4 B
{ ) M9 ~$ \1 J3 f+ l
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 ~" [6 B1 u& r/ R' O+ j4 W" Y5 r
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # o) H j' X' U0 @( F; k# E/ a
if (r == vbCancel)
+ H4 A1 l. ~9 H% `6 O* H( D { % E; [1 H' E Z7 {' v6 `* P9 a
simple.CloseModel(); 6 C; p X7 `- j8 Z" l% b" [
WScript.Quit(); ( W+ Q! Q/ D# r1 J8 r
}
' i, l0 Q: X. E7 @+ j}
1 V) S7 n! }1 H% n/ C ; t9 _0 X5 ^$ y, E% f7 Y; G
simple.StartSimulation(".Models.Frame.EventController"); 0 P+ [% Y, H8 y' D# C
B$ p' }: D- p
if (simple.IsSimulationRunning()) 5 ?1 A$ j. O2 l& t9 @
WScript.Echo("Simulation is running!"); 6 y1 H% I; y* g& V7 X$ U8 {
. R% t& m* O4 i
// Wait until simulation is finished . v; N" H+ m. h" Z
while (!Finished) WScript.Sleep(2000); . P, H$ @1 d# s3 U, }0 g
$ ?2 X3 q( L/ B1 [& A
simple.CloseModel(); $ y8 K3 `# Z& q! [4 B
simple.Quit();
& [/ ~5 m' x0 d1 D: N2 _ OWScript.Quit(); : p: ?5 M: M( I2 c4 W, I# c
4 A" Q* d6 |2 ~1 q, O: n1 B7 {
' s* `3 l0 U/ [function RemoteControl_SimulationFinished() 6 E% Z8 o2 O+ N. h
{ 2 U% x6 L# D5 G, s
WScript.Echo("Simulation Finished!"); |