Example of a JScript " u5 [2 Z$ a+ u" h* K
var vbOKCancel = 1;
/ j' a9 M! t0 l& v: ^var vbCancel = 2; . j7 K9 g. V6 t3 s$ L0 G6 Z# d
var vbInformation = 64; . O1 K( Y) t. @& F# n
var Finished=false; / ? B6 M! [- f
5 z9 Q& p7 W/ P6 Pvar WSHShell = new ActiveXObject("WScript.Shell"); - [ C! x: E! M3 |3 |1 _" a' F2 W
. o3 F* g( |. n+ v+ R6 U' \; a2 h# b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 }0 [. S( A* D% A8 B/ m # y! h. A! X' g# Z) F" v. e
simple.SetLicenseType("Runtime");
p/ y0 V1 e- g% Q& B3 v- k5 v * R, k1 p z9 v5 }$ a* F. }- p
try
0 T4 v5 I7 D8 H% @2 }9 |2 o; A{
% H! Y$ ?8 T4 \- n0 C! f // Enter the path to a model file! 8 v- I/ o& W9 a0 I# m3 x& Q
simple.LoadModel("C:\\Models\\Test.spp");
5 c ]( ]8 T: h- u/ F} . D" |( K7 u2 k6 p
catch (e)
! @! A" M4 j5 d3 X( N{
7 R' I$ k, _# M- i+ F6 _ WScript.Echo("Could not load Model!"); 6 |' p+ }" i3 C- X3 x k a B
WScript.Quit(); ) K! U# ?5 C+ O" p. f( U1 t
}
4 w) |( }1 L, `! L& R # U% W- N( R7 H+ \5 a' e
try 4 l2 y+ l1 h2 H* a, d/ B
{
# w% i4 w L0 {1 i simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ W. l$ Q; Y, c b0 v; g. s2 @! h
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
4 q* U$ g w0 E+ [. s' X if (r == vbCancel)
! g$ ]8 B- w( C7 b3 n0 R { ; u- v9 ?" w/ f! n3 y
simple.CloseModel(); - V l: ]: ]/ j4 R
WScript.Quit();
5 K+ |0 t3 Q$ N$ K9 t3 |/ ~+ A }
9 r7 s' Q% ]. _4 {3 y5 D$ B$ y} 3 |5 h3 \+ W: Z
' ?" ?3 Y) z* E0 p
simple.StartSimulation(".Models.Frame.EventController"); 8 d* s# c2 G5 W
# Z& s1 x# }6 y( z- u
if (simple.IsSimulationRunning()) 0 a' p3 G, L; R {
WScript.Echo("Simulation is running!");
2 y% f5 V7 Z9 x ! t2 [ K1 c, r+ _0 }5 S
// Wait until simulation is finished + x0 e3 X! N0 f
while (!Finished) WScript.Sleep(2000); ( a! E M) u. v( W/ x, P7 P
$ N& H0 [: G5 g/ y- A* Q: n
simple.CloseModel();
. y4 B1 s. r: m/ E+ F1 A, |% U. A* L: dsimple.Quit();
" F/ ?4 S, V+ `, S3 Y9 z. FWScript.Quit(); : w; W Q9 f& |1 b& z5 x, ~
/ ]5 Q% Y; D# s% O; f9 p
/ |+ B9 C6 P9 N; I8 Q& I# Y
function RemoteControl_SimulationFinished() , N5 x' J) p# x! Q! x
{ 4 M8 w+ @" G5 n" { A& D. z
WScript.Echo("Simulation Finished!"); |