Example of a JScript ( T8 ]% i. R2 n) o1 e5 u1 z9 T4 `
var vbOKCancel = 1;
$ O5 X3 p4 N& avar vbCancel = 2; 8 b- i' }& c, s8 c4 Q P
var vbInformation = 64;
3 q h/ k) A5 S+ Bvar Finished=false;
& g0 H( J( W" b, t 0 |& T6 p% ~1 b, @) i r; ^0 ], f
var WSHShell = new ActiveXObject("WScript.Shell");
0 {* N4 d* [1 O 7 @, F# S2 @/ H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
[$ ~( Y/ V4 i" x s
4 _) u3 v2 \2 S2 n7 l6 ^simple.SetLicenseType("Runtime"); , B. S" a$ K+ K* ~
$ [$ R) ]! i# Mtry
7 [0 V! s3 k! H" Y9 J{ 1 y3 Y* S- X& H; w, P6 \2 y
// Enter the path to a model file! . J! B2 i) c4 k% L- b& V1 G
simple.LoadModel("C:\\Models\\Test.spp"); 9 {: q& v( r; u. U) g. a/ L
}
' R/ P7 R& @9 H+ X' y* G; k3 B/ Ccatch (e) * ^; `2 C. W6 x+ C
{
0 \2 r+ E @1 N& _4 F+ c( \ WScript.Echo("Could not load Model!"); 4 c. O, J: |9 y; j
WScript.Quit(); + K/ ^ g( z j0 @( e1 n8 }
}
( o, \* H: i* c- I7 Q! i0 ^6 q. J- W , U' B2 O" c v) o
try
) [& o) v. Y6 ?{
( ?+ u* R" M% d1 J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 O- n4 P* ~. e. f# }. ` r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 4 C( U% S- @% q2 j2 E
if (r == vbCancel)
& W4 I+ G* V n0 E7 t+ X {
8 N3 ^) d1 l9 j' \& W: b; ^( @ simple.CloseModel();
: H/ d. z7 n' D, J2 t% k1 l+ [ WScript.Quit(); / }0 H) }0 D9 G3 E2 T
} : E4 O _) J5 K: M$ P
} * u0 m, {0 R6 K: ~
5 Z2 t! F. U/ e/ e) d6 O7 G/ Vsimple.StartSimulation(".Models.Frame.EventController"); + s4 U( J" F a* c- J, f3 Y
: I. H- d# _5 j0 B; r! s
if (simple.IsSimulationRunning())
" Y) Q% x2 d! ` WScript.Echo("Simulation is running!"); # t/ a4 o7 R$ v. c( j' \
+ r) J$ }/ g8 N. E" t4 c8 i
// Wait until simulation is finished , s* M$ P l. H) h2 I# s2 M8 Q1 z
while (!Finished) WScript.Sleep(2000);
3 H- G+ X, h& R# m7 M" a
' P& K0 u' v& W3 {& Qsimple.CloseModel();
6 J, P. W# s% K% S- asimple.Quit();
4 S" A% D: c T( ?/ Q" U' g7 ^WScript.Quit();
% m3 s, o! ?5 X 6 s& I4 c& @% }+ Z
( |/ a ]6 v) a$ Y( D# J! ffunction RemoteControl_SimulationFinished()
2 t1 B5 c# n, M2 t{
; M! G* B% W. |# ^ WScript.Echo("Simulation Finished!"); |