Example of a JScript
& N+ B1 @6 s" A5 ~" V$ {var vbOKCancel = 1; 5 I6 u% L. ?( n8 _* l) q
var vbCancel = 2; ) T8 ~ }$ ]- g
var vbInformation = 64;
" v. {6 b# f' l7 r* kvar Finished=false;
' ~: m& d3 r& b. }/ [8 _6 N 6 u% P6 g7 n/ Y$ y S; G. @
var WSHShell = new ActiveXObject("WScript.Shell"); : w. B% ]; U1 {5 ^
) G1 C0 d: `* m( |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - u% J6 Z" u7 a6 n8 j& x
) |5 \4 Q% Z* u, x! K w, J* h& m
simple.SetLicenseType("Runtime");
7 k! @$ x+ _7 T* `
/ G& e$ O t3 P; _# \5 o w' Otry
v6 Q3 H1 {) r( q5 M' K{
2 ~. S8 ^' @1 J4 q0 A9 t, { // Enter the path to a model file! ; M- s# _3 K1 T" d2 h
simple.LoadModel("C:\\Models\\Test.spp"); / ?( y1 p7 r" k- R6 J
} 8 @5 h& `; c$ Y1 G& J
catch (e) 0 K I6 ]' d4 I
{ 4 n* r$ c0 r, A) u% @
WScript.Echo("Could not load Model!"); 3 G: P) g( ?+ d7 @2 f. L
WScript.Quit(); ) o% Z& c$ @7 P/ s) L
}
3 ] \, x2 j' x! R4 x' [- ~9 z2 U * `7 h( T: y `4 s, ~- X0 W- ?
try & S1 Z+ _8 g5 _& s) K; `4 Y
{
$ m: d8 F# c) [2 R simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { . f% M& k) _8 T
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 T4 e7 x9 i/ ^( T/ G2 M/ i if (r == vbCancel)
' M3 z% ]; g$ D" q' I3 a7 G4 J {
8 p; \8 m0 J. O$ A- s% `2 s simple.CloseModel();
( Z* U" R2 j3 Q. J5 d WScript.Quit();
1 t; d; i; U+ n, s/ ^* T+ \ }
& k- D7 r" O2 I" S6 C6 P} ) G+ ]- s- {, d" i! \5 m
0 j" h" z$ k4 u! Osimple.StartSimulation(".Models.Frame.EventController");
% w% y5 o7 Y, t% v- A 2 } c+ n4 D- ^' g; w! f6 C$ n
if (simple.IsSimulationRunning())
5 h( D$ ^7 ?3 T5 R) ~& [ WScript.Echo("Simulation is running!"); & G% l% B8 t J9 m9 L: N
( Z) F2 L* N. y! J5 u9 v. {9 Y// Wait until simulation is finished
7 }5 h1 O7 _9 hwhile (!Finished) WScript.Sleep(2000); # w2 x: f# w$ d! I- @3 f
/ x `' i5 {* q" g/ esimple.CloseModel(); 3 O2 p4 F T- l4 W, w9 Y2 w
simple.Quit(); 5 t% L& ^; N6 U3 w. {
WScript.Quit();
j8 I1 A. p7 [* ]# z
1 P& k" m7 j; \( f# f
+ a8 p1 J8 Y6 I+ ?( e- k3 B5 ]function RemoteControl_SimulationFinished() , M2 [# a N# b: i
{ ( ?1 t3 A' S+ n" d0 M) [1 s
WScript.Echo("Simulation Finished!"); |