Example of a JScript . G( i8 t( @6 G# n4 B0 {
var vbOKCancel = 1;
8 D9 ?; D& K" Y/ [, W5 Z; {- r/ wvar vbCancel = 2;
5 r! t8 A1 n7 R: K' n1 Zvar vbInformation = 64;
) U; e0 _, v' m& X% J2 Wvar Finished=false; : W6 N; V6 t' K* G5 s) W' ?
: O, H& d5 Q6 W- Uvar WSHShell = new ActiveXObject("WScript.Shell");
@) I5 Q; v8 x9 _. [ r, ]4 j7 Y! W: h
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 w. H6 X, V+ f D, f9 [. k 7 s: V- T, N: `- K3 ]
simple.SetLicenseType("Runtime");
0 o! W O$ g& F5 ]
; r _, _# ?. B! x5 ^/ ptry
! C( b- m$ `4 t9 y6 L4 y; d* @! u{ - R- O& ~9 j s% K8 f6 j4 ]8 I
// Enter the path to a model file! ' o" A0 p# s* J
simple.LoadModel("C:\\Models\\Test.spp");
1 _& [3 [# |; Y4 ^6 S9 ^} ( O' ]3 v. ?4 W* [, E
catch (e)
. P& U5 g. J: |2 `9 O. Q{ 0 r) d# E6 ^4 X4 m/ E# T
WScript.Echo("Could not load Model!"); % H* M# S) p& ` A& `
WScript.Quit();
9 _) z, C# P* K. k. S t1 R} ; ^$ x, ?, b+ p4 A& o% |
8 ~* J4 P4 {$ @& K, y6 otry ) U0 B) j( P* k" t2 `& X
{ ( U7 X* t/ e) {$ S# i. w+ ]1 y
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . J2 `: H8 ?8 O
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
% q- g; [+ r/ m. | f2 G if (r == vbCancel) * ^* ]% l+ f- h; g
{
* x ^& f9 e* o2 H! G6 K simple.CloseModel();
/ v( l$ h) ~' h# L( t5 n WScript.Quit();
$ P- ^) w9 Q& V* w }
$ K$ {7 \8 k8 @8 W- t}
$ Z6 `8 C `0 `) C. z + V8 ]5 |2 Q3 j; w1 r) G2 b$ X
simple.StartSimulation(".Models.Frame.EventController");
0 |. m5 ^; j" Q0 c- c ) w$ @. H/ j7 |) b, M
if (simple.IsSimulationRunning()) 6 [* @) g0 J7 v8 ]& X! X
WScript.Echo("Simulation is running!");
8 Z4 J |- T% s/ p- z0 O8 ] / H2 p2 J6 B0 A
// Wait until simulation is finished
" c2 ], z5 j9 F+ K0 s8 A1 Bwhile (!Finished) WScript.Sleep(2000); . u8 W a1 h: A# f
$ w7 a0 U. x! m5 d) n4 zsimple.CloseModel();
! X+ {( n7 @# esimple.Quit(); 3 b: u6 S! |6 d7 x# O# Q
WScript.Quit(); 9 U) q6 w# K3 y
& i- _' L+ @& R, q
' G/ U5 {0 s5 n6 u' J0 Q0 ]% g
function RemoteControl_SimulationFinished() $ d- U; H$ J2 g T8 o- S/ U
{ ) @- T% J! q9 P# c8 h; f9 M2 I
WScript.Echo("Simulation Finished!"); |