Example of a JScript ' {3 m; f T2 A: Y& _& k# K5 k I
var vbOKCancel = 1; " s3 G- M& E& S+ F
var vbCancel = 2;
y) h( h( v9 U; N) D$ kvar vbInformation = 64; 9 E# p9 V' {8 p t7 \+ t
var Finished=false;
: M0 ^9 x8 H/ m
/ a% N, _+ U, w" w5 `var WSHShell = new ActiveXObject("WScript.Shell"); * x0 h4 o8 p, i8 q% ]. W9 z$ W
9 r! B7 L, F3 A# F0 N* i$ b. l3 `
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
( m+ A q0 v& P# [ ) ]0 ?) g+ \8 F2 j3 K
simple.SetLicenseType("Runtime");
8 s% D* Y9 h& y% r% a$ ]
9 z, O# f. h8 q+ Ttry 8 M2 [$ ^9 N ?, \; `
{
: o* T! S2 u$ f! r' g( P6 B2 l5 a // Enter the path to a model file! ' z$ n7 L* |, Z) S* h$ R) d* G
simple.LoadModel("C:\\Models\\Test.spp"); 2 ]+ V8 ], n6 e- v) l" r
} 9 ^3 D0 t! x( V5 i1 w
catch (e)
$ @! e) k" f( |{
+ o- }' _; X- [9 Q E8 }7 I* x WScript.Echo("Could not load Model!");
# a" X2 x! T% ^" Z$ r WScript.Quit();
1 |$ F( a! c2 I4 ]5 g0 L}
% Z. C- l9 {: v8 k; o' i# W8 U 9 f( h4 c: n# @* l8 M
try
/ m* S; K. c: M0 E( B{
/ Y( t1 i- L: n d1 f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ ]( \( ^3 _, S- y; |9 X
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 ~& t+ v% p, j" E7 n
if (r == vbCancel) . `: ]" C; h, T$ i- c) }: h5 U' e7 ?
{ , t; i! ^! v0 t5 i% \: b8 ^
simple.CloseModel(); # a% }8 T/ L, ?( o
WScript.Quit(); ! Z. @7 j' X6 M, i/ Q
}
& F1 j+ Z( n B# d4 |} 4 I2 {/ X& m1 X8 J* |. `$ ^
: E+ i& N- m! v9 _9 C1 t0 K
simple.StartSimulation(".Models.Frame.EventController"); 4 w. N- R% ?! e' x+ w% Y8 t' c( j
' o7 R. J" s* {$ N& lif (simple.IsSimulationRunning()) 5 j7 [+ G; H) {
WScript.Echo("Simulation is running!");
; e0 |: v+ ~9 U2 X6 _. \ ) L }$ p$ f& m" ?- I3 q' l
// Wait until simulation is finished ! D" G3 ~7 y' {3 Q" K
while (!Finished) WScript.Sleep(2000); / V" g$ `& b/ `7 r) O) ]! ]* p
( ?+ l% x G) P u0 {! e9 fsimple.CloseModel();
7 J" E, E. i8 A' D9 S psimple.Quit();
* Y, ?, c* O% s' c3 g0 l8 oWScript.Quit();
; Y2 l* f8 c( \' ]) y$ q1 _ 4 K' s% }, G$ o; ^5 l( [
% W9 N0 |' j- E0 |0 Dfunction RemoteControl_SimulationFinished() ; m7 V4 C7 n2 _
{
: D7 @; x- l- S6 ^9 Z" Q- x WScript.Echo("Simulation Finished!"); |