Example of a JScript ; m" `. j/ g5 C
var vbOKCancel = 1;
/ [4 p' c( g6 H) H0 l# s! \$ }var vbCancel = 2; 6 ?/ E* } |( ?& }$ n3 w
var vbInformation = 64; / j: k* B5 K+ a) K3 ]
var Finished=false;
( [( {2 i9 _* l$ J 4 ?" r8 e; G; x8 L6 u* e0 |
var WSHShell = new ActiveXObject("WScript.Shell");
( c6 w" Z) ~1 T" S- X* ~; v% L 1 E9 h; d2 K0 r0 R& _6 S
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
% i$ T) _4 F0 ~# w9 \
6 U0 z M" ~$ `simple.SetLicenseType("Runtime");
4 q1 p: i3 M1 Z1 @ 1 @0 U1 N/ l7 d, Z! v8 |# O3 R
try , a7 Y, N) K9 i3 w. c [7 Y
{ 6 n0 h& \ v+ f
// Enter the path to a model file! - O4 d" N% {/ ~6 K
simple.LoadModel("C:\\Models\\Test.spp");
W( Y; r% H1 p$ I z3 E+ I; {, e} % I6 P# f) K; d; d e$ K( y
catch (e)
+ f o+ P% W* ^) X{ ! V( }" \; o' E
WScript.Echo("Could not load Model!"); 8 P4 s9 K. B8 P, A
WScript.Quit(); / T" [( P2 X% P0 l1 ^$ V& _/ U1 a* \
} ' g0 a1 \" ^ ]' f" y2 A5 e. F
- q" g; o+ r- Vtry
; ~% a9 H2 e! u/ `7 M{ ) f; O/ Q; k) I" U5 W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { " b8 i/ |1 |' w6 t1 _8 a6 o* L0 K
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); . @- C$ ]. E7 H! O: K$ H$ [
if (r == vbCancel) " ^( g2 H+ _. E; A3 t
{
8 X% Q" p4 k" [7 g0 B+ W5 K7 i. K! s simple.CloseModel();
. v4 F! i0 R, C/ Q6 {( c6 b# C WScript.Quit();
& A }1 N" E! s1 ~, y* j: e h3 V }
; f% y/ j/ U- \. o. |" p}
4 J9 J3 V8 ]! s* S0 g* {. b4 s, C
9 t* t: |7 v' Bsimple.StartSimulation(".Models.Frame.EventController");
- R+ W1 y. l( B9 I! E5 c0 d" O
& i$ w; a9 |+ s' X8 }9 Tif (simple.IsSimulationRunning())
0 c+ C9 N Q X0 C. w WScript.Echo("Simulation is running!"); d3 ?* c8 x+ `0 @$ f- ^
5 D! |( r+ Q( s// Wait until simulation is finished
& N5 X* x2 U, x8 mwhile (!Finished) WScript.Sleep(2000);
9 N2 c* Y j+ \1 \/ k # _ f B" U1 t, c7 A
simple.CloseModel(); q% \) Y U+ l! t1 m
simple.Quit(); ! h) a0 w* x+ A5 D0 Y) M% J
WScript.Quit(); 5 G' u5 E: ?. X
4 I4 e5 |5 n% ?# X' P5 K. t
/ a# f% `4 v+ T5 U0 {/ J
function RemoteControl_SimulationFinished()
- ~8 z; G3 S/ w, e6 H5 S$ K A# ^{ 0 P0 ]2 l* P. H9 n
WScript.Echo("Simulation Finished!"); |