Example of a JScript
6 E8 v) I1 ^1 o9 I( r* ]* q/ z' Wvar vbOKCancel = 1;
p/ B2 g& x/ a' Avar vbCancel = 2; ; ?0 ~; U; e4 k4 i X5 b
var vbInformation = 64;
+ }# `4 E k/ U' T6 U5 evar Finished=false; 3 W" X# g5 t7 |' a4 H! p' V/ e/ u
6 f: F6 g( H t- uvar WSHShell = new ActiveXObject("WScript.Shell"); 9 h2 ]- n$ M* p# W1 K: I; d
# k0 U1 ^6 g: I' g0 t
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); + N4 u5 |9 p/ Q& l
9 |! |/ r2 \- Y5 u
simple.SetLicenseType("Runtime"); + o; u/ g# L [
5 @0 ?, Q5 C2 ?4 t. N: jtry - t' k2 p3 D! V
{ 9 Q" U, |0 J- C5 S0 w& S- S
// Enter the path to a model file!
9 W- a& ]. g7 Q3 @ simple.LoadModel("C:\\Models\\Test.spp"); I: _: i* U" ~, o
} 9 L1 ^% p: R( P
catch (e)
0 ~- I) P2 x5 C _% u{
4 e# j) c+ ?9 o1 l WScript.Echo("Could not load Model!"); $ [% ?5 h8 S. ]+ o1 g! }
WScript.Quit(); 7 b# U& A9 @+ G
}
! i/ k: o `& b( K$ J
) h$ X0 q8 O* U+ _, W R& htry ( @( o' g; Q2 w' g
{
9 N3 V6 J n7 Q2 p0 i3 M3 }5 b simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ! X+ s7 S% i( D ^ G, E0 M
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); + h4 [/ z" {, u2 j
if (r == vbCancel) : E& R m1 ?4 P+ A& W% |/ l
{
4 B7 O! |8 b6 a8 g simple.CloseModel();
" E# P9 e9 m3 P. z0 w WScript.Quit();
% _! y+ h) @8 d& Z, [! a6 U( m4 B } ! h6 U1 D$ p# Z% }( S
} : Y! Q3 e) a( Q% A, k" m* @5 X$ X& A
# t7 I% Q! l( o) H
simple.StartSimulation(".Models.Frame.EventController");
# ~2 l3 \' i [$ b! o$ T
$ [5 J3 u+ A1 |$ `% ~/ P3 ^3 C/ U5 t! {if (simple.IsSimulationRunning()) 3 m7 i* a, P% ?- Z8 M' h- {3 I
WScript.Echo("Simulation is running!"); 5 D* d% N' R! z+ r2 i
8 I3 P6 i( J1 m9 F1 ]
// Wait until simulation is finished 7 y- z3 s+ a9 E4 a
while (!Finished) WScript.Sleep(2000);
4 W/ s! K0 I. M# x , \! }/ T& C; N& ~% t2 G0 l
simple.CloseModel();
o% ^4 @4 M! K6 U2 o; Ysimple.Quit(); % ]3 s7 P5 a! d1 B3 }
WScript.Quit();
0 {! d5 S3 ^! H/ @$ f: u ' e3 q1 g6 j2 j
) P& S) `/ D% l
function RemoteControl_SimulationFinished() & X4 i. s0 B1 b5 a% w# J( }
{ # O) q ^0 r, i' ~& j
WScript.Echo("Simulation Finished!"); |