Example of a JScript " e$ n, C- F$ E2 r( M
var vbOKCancel = 1;
5 @2 R% U1 B; a2 Z6 ^+ S' N2 Qvar vbCancel = 2; 1 E+ E+ D/ m3 y- o+ `
var vbInformation = 64;
) l7 E+ k' q) Q: a. b& k0 Bvar Finished=false; ) R5 G9 P* Z) b& z. V
% x3 H) J6 ^9 S hvar WSHShell = new ActiveXObject("WScript.Shell"); ' n1 h' z8 f3 r, a/ Z, o& h
# a. n$ f+ J. G& w* }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); - X& [& d7 n1 f" p; b
% N2 x# q/ n0 tsimple.SetLicenseType("Runtime");
5 J' P+ U3 f" H f, P
# x( `, u7 O" Q) q$ @try
% ~; |1 P7 Q" e{
$ O) F0 l" F! \4 `8 a. t // Enter the path to a model file!
4 D* K" T4 h8 ^; s1 y simple.LoadModel("C:\\Models\\Test.spp");
$ Y9 k2 G f" V) C9 C} ) D6 S! p9 ?0 c6 L1 P
catch (e) ) ?3 S6 _9 i1 Q
{ + ]2 u1 z4 i% g) d
WScript.Echo("Could not load Model!");
# o5 G5 t& B `( e9 a6 q WScript.Quit(); ' \8 c) Y: J7 g6 k$ Q
} % z- z5 c. N9 [# w* x5 ^4 Q# b
& p' E/ X; V: z( P- i
try
]/ |* c( ~2 i- Q: {( P/ T{
% u+ Z6 P, i7 I, b- v simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 c7 t( K1 |3 J/ Q9 c) N: D, H p9 C r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 0 ]( X6 E- K- h5 w3 S: ~) Q
if (r == vbCancel)
" h. v$ `& ^7 P$ @ s+ M% ~ { 2 j0 p6 \5 R+ N8 Z' p( B* r% O
simple.CloseModel();
$ p2 Y7 m4 k6 F: t5 b WScript.Quit();
1 D5 O2 M, t: F- P1 {( U) S } 2 x4 d- Y% J; v- ]1 y
}
* w0 K5 Z+ r( N7 R' E. H3 Q: i
S/ b+ y% \" y* y; `simple.StartSimulation(".Models.Frame.EventController"); % c+ \- V E/ G3 I D( \6 m
( N* c8 I2 Q: @1 Rif (simple.IsSimulationRunning())
. H' q: W1 V5 {! b WScript.Echo("Simulation is running!"); ' B3 I9 ~. b$ V
: T# y4 g3 `) d2 B// Wait until simulation is finished
! A" a1 k2 V: owhile (!Finished) WScript.Sleep(2000);
& R% H; l. ~8 n
2 _4 l v, I0 g4 f/ T9 R& p @( i! u9 Psimple.CloseModel();
3 {; q0 a$ A+ w/ i% fsimple.Quit();
! E) }0 h! L B$ S' sWScript.Quit();
! p+ E9 G7 R1 K' g4 o, M/ `
% l/ @" r c, D( p+ n1 T T* r9 N/ X A
function RemoteControl_SimulationFinished()
) }" M* `0 W' u" \0 i2 L{
7 X! g) H+ J5 I% I+ ~) t* B WScript.Echo("Simulation Finished!"); |