Example of a JScript * w( s+ P2 B/ S1 v* `
var vbOKCancel = 1;
6 M- T% J4 u5 U7 @8 svar vbCancel = 2;
; X" \4 \, \6 R3 W1 Dvar vbInformation = 64;
% |: p* |3 M6 Q1 Y# A( Vvar Finished=false;
( k- Y- T, Y1 C& B$ [' j2 L6 x( K + R! x- ~! c/ b$ @
var WSHShell = new ActiveXObject("WScript.Shell");
V& b; d0 {* C& m/ W$ U U5 p0 q6 V , g" {2 y4 ]- V5 h& q1 r7 F
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) `. h/ R3 @+ F* ~6 i0 Y
$ D9 a. _ R) v8 b5 Q r/ O/ l
simple.SetLicenseType("Runtime");
+ I' J# ?5 {5 B& E, K- l
$ O/ s" _' I2 {try
# n; e8 T* j8 {; {$ n{ 5 B% F# p8 Q9 `) M6 t$ D
// Enter the path to a model file! . P& O7 @! u- l
simple.LoadModel("C:\\Models\\Test.spp"); 0 b* I' H1 \# z# v5 e! G
} ) E. N/ W% H# } H
catch (e)
) b$ Q+ A8 p' M1 a' W{
; N2 B/ k; w% u WScript.Echo("Could not load Model!");
' K3 H. b: i. ` WScript.Quit();
9 \! h" H) T- p' y! s} * ~7 ^; q5 `$ t5 P; A
6 H* T+ |2 U, t% E9 ~* K5 R; }% @! N
try $ }" G, b. |* l( B: P
{
& {8 g- ~" ~& `) h& L' _- r- X0 U simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 J& j7 p% P5 Y+ v9 y! ]* h r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 {1 L5 O9 h. C if (r == vbCancel) - {/ x/ p( U( C. V
{
& D+ l6 Q. ~" C2 | simple.CloseModel();
* h% l$ o! ?8 M$ [) F6 e, O WScript.Quit(); + C4 P2 w& j$ s2 @
}
% g/ E( ~7 Z' v. N. G. H7 h} $ [+ H5 d5 I" q3 y/ R
* m& v$ _, d0 P& ysimple.StartSimulation(".Models.Frame.EventController");
Y: f" N3 |# q' A3 \
8 Z- W% h( R4 Y t( u. Dif (simple.IsSimulationRunning())
3 ?2 c# K) F: p% u; f- r& ~ WScript.Echo("Simulation is running!");
) @; z$ l" x. l, U0 H; h8 p + v0 s5 p4 j. t1 q2 K* I8 J, W2 r
// Wait until simulation is finished ' O5 ~ s& N9 h4 {7 v! z, |
while (!Finished) WScript.Sleep(2000);
3 H) a' A# ?% }+ m( b6 X6 w' G' I
8 F+ r" \1 d! c0 tsimple.CloseModel();
; [" i% ]; R+ H. I5 Jsimple.Quit();
4 X0 h# n6 s: S4 M9 {# EWScript.Quit(); 8 h# Y7 w% G5 I2 U* J
4 k* {" s# v' E& j
' W' W, N# k* L5 R; qfunction RemoteControl_SimulationFinished() : l, u& b! D5 F2 K
{
* U3 ]6 I2 {0 C WScript.Echo("Simulation Finished!"); |