Example of a JScript
2 Z4 B2 X3 M- _7 t% D% b# F- Ovar vbOKCancel = 1; ) \, ?5 U$ B/ U
var vbCancel = 2;
) q! G: G4 N! g6 ivar vbInformation = 64; 4 w5 b O! F; v" Y' Y7 |9 d
var Finished=false; + x0 }2 P6 S6 C$ T( J F8 Q3 y
& s( Z2 [/ Q `% V6 {; }* zvar WSHShell = new ActiveXObject("WScript.Shell");
2 o8 Z2 T: B0 m [0 g0 G/ s " ^' S# L9 F6 H! |
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 4 j0 B. F& T [( K5 w
$ _3 H. y: {* _! D* tsimple.SetLicenseType("Runtime"); ' L% A: h; T! X& k# a% C7 n1 o
" r. m# Q; K- n- c5 G [7 ]5 w
try
+ b) c3 G6 }4 A% H+ q2 Q& V{
: `9 A* L8 W# j1 Z // Enter the path to a model file!
8 {( l4 T4 v( R2 ^# w: H simple.LoadModel("C:\\Models\\Test.spp"); 0 k" T5 R4 K" x- i6 d. Y" o/ Q1 V
}
' X7 Q2 z: Z- U) v4 lcatch (e) ; S7 Z: `3 M/ @( Y& Q
{
. I7 R$ v m; u/ a WScript.Echo("Could not load Model!");
5 A5 W6 O$ k1 x$ r! a5 e WScript.Quit();
1 ]" _& q4 ^2 `9 |} 4 U5 i" O' \* ~( w" i" j
# p* L+ M6 c/ W7 q* ^2 Mtry
- j3 u1 U; W) S: X0 x8 _{ . Q6 j# |6 ~& ~0 `. s0 f2 L
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { + |# B+ r" ~3 _1 Z/ \: u1 O$ C
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, d& q5 Z9 P/ C3 }! G7 B if (r == vbCancel) 2 }' d; {) @7 I e
{ : }$ k* E0 c* n; x* `
simple.CloseModel();
2 d( g( u1 T) u. }% B) E/ W% ] WScript.Quit();
0 m& s. W6 J- ^9 Q3 _ } 2 c- I+ \7 I2 d/ m2 z6 F$ d
} 4 h% b* U9 D [! n
2 O! c5 n1 S8 P: u
simple.StartSimulation(".Models.Frame.EventController");
- Z8 C$ n/ M o
+ }- H7 a7 [0 h( t# {if (simple.IsSimulationRunning())
: b( s2 m" R# s' @& M WScript.Echo("Simulation is running!"); , F3 M8 v4 Q& t% D+ R$ Z
& P N+ [2 x" ]
// Wait until simulation is finished
5 a+ [, n- e4 C6 k$ W) R6 S% F( ?5 Hwhile (!Finished) WScript.Sleep(2000);
* J7 V2 T( y) ?% c
( \* P6 B# ]/ r7 Y- q& B& V" esimple.CloseModel();
/ ^5 u& F/ ]" j# f5 b2 Osimple.Quit();
& }$ B; t; a) q6 Q6 L+ h# J+ OWScript.Quit(); * m8 [ w; a4 a* Y2 ^
8 s$ r+ r0 ^# N% {2 E9 @8 A0 ~0 _
& y" N8 ?( d) Q% \ j7 m
function RemoteControl_SimulationFinished() 4 `" ]) X5 L$ p. W E" W
{ ( v3 k! s+ L2 H, Y. ]5 U, E A
WScript.Echo("Simulation Finished!"); |