Example of a JScript
) x* U+ C$ b( J5 W0 Kvar vbOKCancel = 1;
, O. l& R/ X& H4 q* L. p! Uvar vbCancel = 2; - B1 o& b" z6 |* w+ l
var vbInformation = 64;
! o1 m( I0 I& C( Q/ X4 O$ hvar Finished=false; + i6 E0 ]+ K C
. F' w* o- ~. F2 b, ^7 [var WSHShell = new ActiveXObject("WScript.Shell"); ; v! G9 t* Y8 R
0 B1 {$ `! K) e' E/ O) U( H
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); I2 ^8 C& b5 h9 R. L. ^) c
3 t- c1 q# V/ L4 x* w, [
simple.SetLicenseType("Runtime");
8 Q o7 i2 P# ]; }" H! R 5 l, r% T- k7 A; W: z
try # K, D/ z; S8 [
{ - |8 _) D. Y* u+ g ^1 K" R* |; Q
// Enter the path to a model file!
/ U ?1 Y8 r1 Y# ^( X8 { simple.LoadModel("C:\\Models\\Test.spp"); : w2 z: d1 G! S( P8 Q
}
1 S, d, T" O) r" E/ @( A. Ycatch (e) ; t9 o2 `2 {* w/ ]
{ " Y! Z" C0 ~6 }/ ~# H! l* @ v
WScript.Echo("Could not load Model!");
2 l; ^8 A+ q% D! L+ h5 `6 b; a- G WScript.Quit();
' e/ P* y: o8 O& R2 \4 d. \}
' ^: k; v7 U! X( p
2 P; Q' B% r- I' h Itry
0 n7 W. g3 U0 V8 p; J" I5 o{
$ X+ q$ t5 V/ K1 e3 f simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { * C+ h g5 Q, S' n# A! o* z/ U. a# @
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 B+ S' Q* G1 g3 y' s2 i8 r if (r == vbCancel)
, j! p3 p2 i& Q* t( n9 w {
; r3 }7 w5 K$ c( h6 ~7 r simple.CloseModel();
$ X8 l8 `, Z& `$ D5 C, B WScript.Quit();
) K- q% a* B& X+ e* ? }
! U) e' p& m+ D6 u8 j) f3 {} " J6 u( L; S( @' b9 t# c
[5 A" {5 L8 h5 O0 D2 ~7 R3 f. B4 {
simple.StartSimulation(".Models.Frame.EventController"); 6 ~& f' Y4 l3 W
8 I1 N7 o; N1 W) d( {1 |' T$ K, A
if (simple.IsSimulationRunning()) 5 u! W+ ]4 F( u3 S$ x2 K6 M3 f
WScript.Echo("Simulation is running!"); ; [ n- z+ N# T5 ~
6 s V! G) K9 L* w. D3 U0 U& O// Wait until simulation is finished
" M# {2 i: j' W. G3 [1 {while (!Finished) WScript.Sleep(2000);
# Y/ {- z& H( [4 } L( ^ S _0 W3 k b$ O
simple.CloseModel();
8 [7 `! R, C: ?' hsimple.Quit(); 7 u) t) L w* d! E# G' U
WScript.Quit(); / v- B4 L0 y: r9 N
- f' n0 X* Z: S, }
7 k1 j- V1 D7 B. y: {
function RemoteControl_SimulationFinished() 5 c& T- `0 h4 t$ p: g7 S
{
9 t1 E+ {4 b {4 R WScript.Echo("Simulation Finished!"); |