Example of a JScript : o. C3 n# l- \2 b7 i& c% _
var vbOKCancel = 1; . G2 P$ V. E% |7 u2 \. J8 B: ?$ o
var vbCancel = 2; ' g' D" J$ H+ ^
var vbInformation = 64; 1 ]; f9 P+ Z* F0 a/ F
var Finished=false; / ]( g# N9 K+ O1 k" t6 `/ K8 z
9 ~- D* c- ^9 rvar WSHShell = new ActiveXObject("WScript.Shell");
, A; }$ `7 `2 R( w& K# \& [ " F/ {2 ?0 z0 {5 q. o
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
/ [! U6 a, s0 o) H1 b
" l! |: ^( N$ p4 g( j% C) C4 j, P& `simple.SetLicenseType("Runtime");
7 c2 a% J. Z2 _& Y
9 t3 _2 Z/ ]+ A/ D5 Gtry & G+ ^( y9 { ]2 `, U, B/ w
{
, y" a$ V) O& W% c* Z // Enter the path to a model file! 0 q, ~6 n( [; s' ^
simple.LoadModel("C:\\Models\\Test.spp"); ! \: P/ h5 {% {
} 5 p/ u) `2 s1 j: s$ D0 U
catch (e)
7 R9 g7 K9 a/ K# G1 R: K4 y{ ! Z8 o' y& t Y; n; F- D1 K8 B
WScript.Echo("Could not load Model!");
7 r& O2 m0 k0 H5 b# Y8 I WScript.Quit();
/ o8 X' z! E* V4 x}
! ?, h4 l6 Q K! g
& x, H i% A; m) B; [try
U2 ]* q, ~4 i9 m{ . u+ s* o# }3 }# r' D; y0 s
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, X }9 y7 C) C6 P- A1 r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 5 U) y) e, d5 e3 Z) x) h7 w
if (r == vbCancel) 8 n4 S- L% a4 T8 e
{ + H+ ]: u; a/ V8 d' j% i
simple.CloseModel();
. i+ C2 {9 j+ F# } WScript.Quit(); ! S2 m$ z5 u9 v! V( l
} 0 `6 d [' F0 `$ H
}
7 K( P2 L. p9 ~7 J, \- g
$ M" o* g: F: `/ n) Xsimple.StartSimulation(".Models.Frame.EventController");
9 z) l8 F. |: D ( E* x6 `% ~! u+ C0 G
if (simple.IsSimulationRunning())
6 \+ s5 {5 N) Y% q4 a6 M! x. o WScript.Echo("Simulation is running!"); 5 o0 W6 a" O- Y
& X; j B7 }# q0 K3 u0 O/ Y// Wait until simulation is finished
' L$ K6 Z# {+ F: Vwhile (!Finished) WScript.Sleep(2000); $ I. k, b% w4 U, @! h
9 K9 k/ J3 J$ O. j& N$ z" F8 _" E
simple.CloseModel();
: p# d$ V0 c# t/ a0 p6 Msimple.Quit(); + w8 v# X) P7 s' g4 }) V6 `
WScript.Quit();
0 `+ u: }/ g! Q# y% v$ c
/ Q6 ^/ c, J4 {$ p' ` ! o! i2 H. S6 _# I$ F9 ]" p, P
function RemoteControl_SimulationFinished()
: a6 Z# |6 G/ w{
0 z; l6 a- T: ` F7 R# E WScript.Echo("Simulation Finished!"); |