Example of a JScript & l6 O: t n+ A5 z& h' c$ d$ z/ l
var vbOKCancel = 1;
, A! q6 {1 {) ~4 c0 |, J h* ]var vbCancel = 2; / h) x$ [4 w1 `0 Q' G. @$ O
var vbInformation = 64; & T7 `: Z* E/ ^# B& T% @
var Finished=false; 6 F& J2 I4 b. Y4 F+ G8 a
. L! S) {, T0 I- uvar WSHShell = new ActiveXObject("WScript.Shell"); , W+ r* \5 Z: h3 e) ^
- p- ?0 p+ v5 `+ y$ R1 m I" ?var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
0 _/ O% u# Q% j0 ^
1 u) s# C4 n3 D9 E- d7 S' \simple.SetLicenseType("Runtime");
q0 H6 z: k$ K9 }9 |$ ~% T1 q 0 ^8 Q/ B9 n F: k2 |' l; D
try 5 g- A& _6 ?* Z$ P- ] K
{
) X7 n# r9 x) d! z& f" T! f // Enter the path to a model file!
% _" R* C: u6 L8 J4 q simple.LoadModel("C:\\Models\\Test.spp");
$ w. r8 A: Q) h$ `7 w}
3 O7 ]: P$ Z$ ?6 s/ ccatch (e)
2 J4 `8 u% V0 l{ 0 t X& ^6 r* W3 e
WScript.Echo("Could not load Model!"); ; }$ c% P0 F( a1 P" f
WScript.Quit(); / {& _9 o; t. X8 j F; J* {5 \
} ; C' v. T# {4 I$ f" v9 a( k% M
4 i/ A8 {0 t6 X* T/ c) L; ~. _
try
+ Z3 l* N- J* U{
- O9 P' [* T2 w4 G D. @5 w simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
`7 ?& H5 `0 S9 [% {( O+ j, n' k r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . G% A& S9 M5 j- R5 f& T( s r
if (r == vbCancel) , N9 k. {8 i8 n- Q% K
{
) p0 |1 ]6 r0 E) c) T. V simple.CloseModel();
0 J' m5 z/ p; Y2 Z7 y. c+ h WScript.Quit();
g" J$ d6 M/ Z8 T D' _* o }
% [1 q6 X, R& @& B8 H} $ h5 t" T9 T5 n
6 I9 w& Z* z. D! e8 V/ qsimple.StartSimulation(".Models.Frame.EventController"); # C3 y. ?- J: W3 u8 `; {0 n" F
5 m) }$ {2 S' ]" }3 q3 eif (simple.IsSimulationRunning())
" B& M6 y3 r4 d: ^6 E: x WScript.Echo("Simulation is running!");
) Z8 g& P! i% M
H* X2 E# @4 Q- G// Wait until simulation is finished
# C9 D5 b, \1 A( ~while (!Finished) WScript.Sleep(2000);
) D$ w% N' q9 a$ |! d+ v/ q
' ~) @' n9 G0 T% }simple.CloseModel(); + R& m/ S1 X- o7 e1 m/ |7 U& a/ `
simple.Quit(); 3 \, i1 K4 a$ ^5 k2 B# \
WScript.Quit();
6 W7 v. C# p( y 8 k0 C5 a. ]# C
5 A% ^) q" C! f0 i6 O8 U8 }function RemoteControl_SimulationFinished()
; h3 n4 K0 {- M{
/ R; G( d2 G$ g0 j" G WScript.Echo("Simulation Finished!"); |