Example of a JScript 7 r' U6 c7 T2 f1 r Z, P# \
var vbOKCancel = 1; . e9 f7 `4 N0 c! Q
var vbCancel = 2;
3 A- J1 o4 U9 r. H6 G9 i. }var vbInformation = 64; 5 t3 K- z; N( P3 J
var Finished=false; " l+ Q( i% v5 N& |9 f5 |
1 Q* `9 A' Z* p( Z7 l, v2 w8 Xvar WSHShell = new ActiveXObject("WScript.Shell");
; G6 x. [% Z, b" _9 u# h3 j 9 J4 q0 Z/ k) m# l+ G9 f6 j
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); : y5 L8 [/ d* n7 J+ v8 e
2 ?, w4 o9 H$ l7 ]simple.SetLicenseType("Runtime");
3 U. q S& J0 J3 z6 v& R) J L 7 }( z+ k' J8 N# Z. S4 r
try
6 ?% y5 w4 I5 J f* X; ~. {* n& ]{ # C3 ?& F! c5 A) o3 d
// Enter the path to a model file! z! k. y0 u6 z. D' t
simple.LoadModel("C:\\Models\\Test.spp"); # w. r$ I' |: J0 K( H1 I
} ( w! U6 u' [% E
catch (e) ' j5 D7 [; W7 f8 J
{
: b# g9 {* h) e9 D, |6 N3 O) v WScript.Echo("Could not load Model!"); 1 g9 j8 `7 e! I9 Y- W
WScript.Quit(); 0 m% P6 s; N$ H( t
} 0 Y7 ?: b5 T2 f, }. B
; l, [* B5 p# m* n$ A8 _; J( htry
0 r! Z( o0 _6 U# o{ ' }. {7 A; Y/ [ @% J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 u$ y; E8 v4 w6 l- d r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) C8 O, L- Z) @: q9 a
if (r == vbCancel)
6 R* ]5 d" E3 V {
2 W+ O$ h8 l/ F simple.CloseModel();
* n' |3 X; y. w3 b, }$ V WScript.Quit(); ! e* N8 d: Q" B+ m, o
}
4 R' R- j8 \5 m2 \3 R9 w} # f/ i' \$ s& W9 N& o/ ]' g
E1 n5 x# j; T8 p# {* j
simple.StartSimulation(".Models.Frame.EventController");
0 H2 z t; r$ c! g 5 K9 U7 e; L" \' i; g$ K! i% u
if (simple.IsSimulationRunning())
+ W4 \7 g: \; L WScript.Echo("Simulation is running!");
( W( ]) z# k" G* y& b
- r* B }4 o0 B: j6 K% |5 U& ~+ H// Wait until simulation is finished D0 X, m9 _# N. Y" F: N( n7 `
while (!Finished) WScript.Sleep(2000);
# t) n% ]- \3 ]) Y3 M- s$ N8 S 2 }) z* r( k, [/ O U/ D
simple.CloseModel();
* |) f0 V8 L2 W2 F1 [7 W8 p n* ?simple.Quit();
+ q1 q' S* n2 P3 |$ DWScript.Quit(); 1 G3 q: Q) t% F5 h O2 J
4 ~ c; Z& q4 j4 e& s* I - B _, ]& J. M3 r
function RemoteControl_SimulationFinished()
/ a% H7 F* w* b" K1 ]{ 4 |- O5 R8 G( q& A+ }/ t
WScript.Echo("Simulation Finished!"); |