Example of a JScript
! l5 q0 L- B- Dvar vbOKCancel = 1; X! p, Y9 L& B; r V0 c5 a) o
var vbCancel = 2; ( T: o5 X9 N7 i. }
var vbInformation = 64;
2 `, M. R" K. C9 n) M5 u5 I& Tvar Finished=false;
; ]5 L, T* l- H( V9 b- ]* R2 X1 y7 Q
3 u5 ?; T- V# x3 W& dvar WSHShell = new ActiveXObject("WScript.Shell"); . r6 t& R7 [6 o& @4 J8 d, x
4 z0 f; @9 `0 o3 V, T+ L5 c
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. C9 r0 P0 o! J/ e/ A; e2 K$ ]' v 1 o* w# d' h" G. B% `
simple.SetLicenseType("Runtime"); & t- ]. h7 M' L K; `/ b/ Z- M
1 O8 G' Q6 v6 |' Ttry
0 O. s0 R# p2 Y/ V{
; z; \- P2 i7 c9 l3 Q // Enter the path to a model file! $ \; P) I/ k$ u
simple.LoadModel("C:\\Models\\Test.spp"); # n: l4 y8 r) f5 f3 E
}
+ C; P, k( h/ j( B1 bcatch (e) : |+ Y# l2 B; t( x( X1 L( E8 T
{ " F5 w& C8 X0 X5 P7 P; w/ ]
WScript.Echo("Could not load Model!");
! U0 n0 i: l' \' }& E WScript.Quit(); % Z' B5 |' `: z" I& m
} ; r4 N$ H1 |7 C7 h( V! L4 ^* i
$ ]4 c% y8 X/ otry 4 ^; ?' S: M, y4 v
{
- d+ s# s( P( r* q' S+ T simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 9 g9 d5 `+ I" b8 P9 t2 a) Y* A
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
! ~5 J2 t& a+ i# q8 A if (r == vbCancel)
) i) X& Q& Q6 S8 B { : d2 ^% W/ ? W
simple.CloseModel(); 7 r/ [& j2 M8 \2 `' W
WScript.Quit(); % `& Y- ~0 U! ]8 ?) [9 m+ l
}
$ Z( N* ]% i1 [- z% y}
. J- M. k0 T+ d7 U: e( }# P ( d1 d3 k3 H5 A( R* z8 _* n
simple.StartSimulation(".Models.Frame.EventController");
' a! K- Z$ m, o ' H+ c. b9 R3 r3 _! M' @7 L
if (simple.IsSimulationRunning())
* p+ P, e' n1 _ WScript.Echo("Simulation is running!");
$ C. Q( g4 Q/ V# f. p
7 H+ \ y) Z+ p% S) x9 y0 n// Wait until simulation is finished
! _( @& N' s/ X! ], W! o# T/ x7 Ewhile (!Finished) WScript.Sleep(2000);
4 X) r. m5 w( L8 @3 V; f & m5 g2 ]$ u! g8 m8 ^ E1 {
simple.CloseModel();
+ T8 ?8 w. h6 I# z! @7 Y" Lsimple.Quit();
/ U7 { t6 q) c7 `! L6 FWScript.Quit();
& l( r0 x6 f" B' q8 W% L
$ u" |6 h( m, y/ J. L" U9 \9 m, w 9 E7 Z; ~: M- v* N4 f5 C$ g3 Q% j
function RemoteControl_SimulationFinished()
2 v7 }0 z9 K# f, L{
2 H, }) H/ w" D WScript.Echo("Simulation Finished!"); |