Example of a JScript
+ {9 X: V1 C# ~2 l0 Xvar vbOKCancel = 1;
) [& k1 t' B u C% e7 Rvar vbCancel = 2;
' k L# f6 C5 N: Z. r) xvar vbInformation = 64;
% F- x6 C$ ?2 A, Xvar Finished=false; 0 J. t* a. m% Q% f/ n
% F9 Y+ ~5 Q3 F
var WSHShell = new ActiveXObject("WScript.Shell");
u, y s8 Z+ G, r% k- d& {. |1 x$ v
4 a5 u" W5 v5 Hvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # p4 h+ V& S) {& R" o! U8 D
9 J5 e/ _3 ~) L# t: P: J$ e+ d
simple.SetLicenseType("Runtime");
7 o2 }( A5 @4 N& W" c% x
; q' M3 P3 y B' m* C) _4 g4 O c1 \try
" O) J6 T/ L* T; Y% M& \{
5 ]( }+ r+ x2 E // Enter the path to a model file!
j- X& p% H" | simple.LoadModel("C:\\Models\\Test.spp"); ( x# c9 i8 Q# u% `: i
}
9 w: L0 T& U5 O$ wcatch (e) 8 L! a" t: V: ]8 c: U! |
{
0 z4 a; o( b4 Z' f+ m WScript.Echo("Could not load Model!"); " ~- `1 {: s+ ~; d
WScript.Quit();
6 _- @2 y5 c( u2 j0 f$ s: x}
% u5 H9 e1 @% ^1 S* _3 Z
5 w! ]9 p: b! J9 N: Ttry
+ A V# O- v; _{ 1 T( m; u, ^& J2 I
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 z5 ]4 L* J/ ?+ ] \7 B- V# |
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); & u7 v* i. p1 y/ C, O+ N3 z: W
if (r == vbCancel)
# \8 G( {9 y; ?6 V& ]( a {
N$ D: s8 M9 \' k7 x simple.CloseModel(); |, @; C) q1 @7 z& u
WScript.Quit(); 3 `( V( m4 [/ k# O5 o
}
+ u: J. Y: V3 v% F} ?8 f% z0 z" ]
7 c9 l. B. I! G" O- {& ?, gsimple.StartSimulation(".Models.Frame.EventController");
. q1 E0 g" P. W6 o3 ^; H ; Q( p" `3 Z' `
if (simple.IsSimulationRunning()) 9 M- K" h0 a+ `3 c
WScript.Echo("Simulation is running!");
0 o$ H) l2 o- C5 ?7 c4 N) K
: K, [& ?& D& g5 C; V* p% ^" q) a// Wait until simulation is finished
; Y8 P5 E" m- wwhile (!Finished) WScript.Sleep(2000);
3 U& h! y( k/ \* v2 R * U. S2 q: {8 A
simple.CloseModel(); U' B! ~1 `! C; L8 a
simple.Quit(); $ r% o0 c' D9 |9 M( j. Q, r
WScript.Quit();
' ?! V1 f) {0 E5 ?: A$ @ 4 H" f6 k) [/ `; |% E
/ f: t. b, \9 B8 A: |
function RemoteControl_SimulationFinished() % j$ `* i8 u! h0 ^" X4 _3 L+ x
{
% w2 z$ I3 [+ d& q- Q* U WScript.Echo("Simulation Finished!"); |