Example of a JScript
8 n, F7 u7 H' G6 K3 S" jvar vbOKCancel = 1; + Z) l0 C! q/ Q8 _* F
var vbCancel = 2; ! {) j) z2 m' Y3 Q
var vbInformation = 64; 5 D9 j- _- O0 c8 u1 Q' d; ^, R
var Finished=false; 9 {5 l7 h @8 u' O z
, ^/ ?( Z" }0 v( S* P) `% U7 Avar WSHShell = new ActiveXObject("WScript.Shell"); ) H* f5 P* u! @9 |) b
/ d2 S% O6 o9 x. P# B# b
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# N# a; i$ R. N1 q6 M; H2 T
$ `# y$ U! F. ]2 \7 N" r- `) h0 Xsimple.SetLicenseType("Runtime"); 7 m3 m' l% p& _) i6 }
5 ~2 A4 m: `9 @, Q' N5 Y# q4 B/ K
try
0 p! }4 l' V# S8 A{
( |2 u. `" ^1 S; {8 X // Enter the path to a model file! / }2 M6 ]5 E. `% G1 F; ?& j4 S
simple.LoadModel("C:\\Models\\Test.spp"); 0 s6 N: y6 k, n
} * ^& X! i: J/ t! j* M g
catch (e) & p- q" d2 x2 l+ O I6 M
{ * p3 {2 z" r G) f
WScript.Echo("Could not load Model!"); + v2 K; ]$ Y+ g; e9 r& b; g4 m& ~
WScript.Quit();
% y5 }$ Z, t6 m2 R% ]}
5 h* _, D6 j3 V( n 9 H8 Z; V, @% c; d
try % _1 K3 Z7 [, ?4 k, E' E
{ & P* g9 \8 |/ D
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, B" [9 w; {- ~: {1 E- F! ? r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" e6 w1 w0 Z% {7 Q! \8 P; U' G' q. N if (r == vbCancel) ; f. q7 s3 n$ }4 w& ~ i
{
! ~2 f0 m" ]' j simple.CloseModel();
3 B$ t' C+ J9 E0 Y WScript.Quit(); 1 R5 i. m% ~% n. d
}
' @: {% a4 |& M4 q o. q2 I6 l! e} 1 H* ~% h2 l6 c* v8 @; C& M I, ~
. J9 } V9 K" d5 ]4 L
simple.StartSimulation(".Models.Frame.EventController");
z- O& J- Q" b: y( C0 e. ?
: g+ y- _8 P6 m I' W+ _5 lif (simple.IsSimulationRunning())
O4 s7 C/ C5 k0 \! I/ o WScript.Echo("Simulation is running!"); # ?! w' l3 Y2 P4 @
. B% _: S7 s7 M7 l/ O' V' X// Wait until simulation is finished
8 Y' U( X% B0 m$ Qwhile (!Finished) WScript.Sleep(2000);
( E* n- E) I) E2 u0 S8 Q9 K
% N9 R6 W$ x' L1 |1 X( u" Hsimple.CloseModel();
) n+ j2 @' o1 L: b' f$ Psimple.Quit(); & z4 x0 P/ p z: R, U
WScript.Quit();
+ i/ h8 {3 R1 \3 N0 Z1 \
9 r: T, j' Q. |& ^1 T8 b( z 7 _ R* B; C: o: h
function RemoteControl_SimulationFinished() " p- N- G! a8 N, Q' d
{
$ I6 Q0 w3 f1 H& n7 x ~ WScript.Echo("Simulation Finished!"); |