Example of a JScript
% r- P* ]! L/ Wvar vbOKCancel = 1;
- P8 p; f2 k3 l) A0 zvar vbCancel = 2;
$ Z: x/ }5 B& e/ X/ I& P: {var vbInformation = 64;
. s" r$ l* U1 T8 O. W2 ?: k& lvar Finished=false; / T9 o; s0 n* k. l$ s
7 d8 ?! ~( V& A9 ?2 M* H u
var WSHShell = new ActiveXObject("WScript.Shell"); # ]; m1 }1 _$ L! P: O% Z! K
; ?) ^5 S7 {: d0 P# w3 r$ m. kvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - H7 |5 h; w6 ?) V" \
$ U/ v+ M8 s. l" x6 I$ H7 Rsimple.SetLicenseType("Runtime"); + X3 \% {) }! v2 O* S: d% l9 F0 P
2 G$ j1 h# b8 E2 `: G6 L3 L) vtry
. G/ S" b( X! e8 w, h{ 5 x `, _5 \1 R( ^" Z$ y4 P
// Enter the path to a model file!
2 ~$ N1 N8 K; n6 S' X- q simple.LoadModel("C:\\Models\\Test.spp"); # O0 T& t' u3 o4 a
}
& y8 L' L) {9 L+ ^. fcatch (e)
# Q1 `( `( d: O! P) b$ V. R{
* q4 ~# b6 V, k) @# c; J WScript.Echo("Could not load Model!");
" S5 T) m: k. Y WScript.Quit();
5 U! q5 P+ |; x% t& }# B}
( |' _. Y/ I1 e$ S- q% u% n0 W# k 5 D" ~6 N/ H# i' S Y
try , A# P4 b- o0 N" M4 X
{
' K; N" ?8 \( }, y) z ~% R" k simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " Q; O) f* p3 @' M6 O5 P; X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); % q6 C3 c$ r& M E7 m7 m+ L
if (r == vbCancel) ; M+ S; t" U5 L' B8 s/ B8 Q% `
{
' O, Y/ @2 b' }( A- X% R! J+ }: B7 N simple.CloseModel(); + E0 u" c0 v" ~' `2 i2 ?
WScript.Quit();
* F/ g) ~3 x+ o! v } & P$ d4 B5 R5 g C+ g, O5 ~
} - |4 C2 p. d& s/ A
; ~; U- L H' j6 t$ [* Z9 B
simple.StartSimulation(".Models.Frame.EventController");
8 c5 @0 Q* f$ ^9 M, t+ F
/ p1 T& `) [6 sif (simple.IsSimulationRunning()) . D& U7 A9 W- A
WScript.Echo("Simulation is running!"); 7 L6 W8 ]$ H: E" u8 T; ~: z$ A
( I7 S6 M! X6 Z, Q+ O) |( ^, m// Wait until simulation is finished ) f( I" I7 I5 G. o
while (!Finished) WScript.Sleep(2000);
3 v+ V' M2 h( [ w: i
7 e+ l6 s, a7 L2 |simple.CloseModel();
! d9 s* V7 d& b1 r# }8 M2 Rsimple.Quit();
( f& j+ ` B" K; CWScript.Quit(); - J, k5 \9 P( B$ ?) O$ y
7 Z' V ]' q* H2 E
9 |7 o0 b/ z: [. d/ w; qfunction RemoteControl_SimulationFinished() - R0 N: ^/ @1 j# T0 e, n
{
0 D* q7 s( T) h WScript.Echo("Simulation Finished!"); |