Example of a JScript ' h; Q2 w# \/ t& g P
var vbOKCancel = 1;
& C* i% X) u+ L6 u9 Kvar vbCancel = 2; 5 C9 ], Y0 c8 w& ]; B: D/ o. a
var vbInformation = 64; 5 V& b4 y7 |' Y- T/ n0 K* d
var Finished=false; 7 V: E, h5 ^' V: b" K+ l' E4 Z
8 e, g/ k4 u: Z2 A# [: W) i
var WSHShell = new ActiveXObject("WScript.Shell");
$ h$ [- M7 z3 E) z# p% h5 \; l
9 M8 J4 \: g8 {; [var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); % O" K! K2 X2 R2 l' v4 h4 W5 z# q" \# ]
+ E) Y" j) C# p: r/ n, K
simple.SetLicenseType("Runtime");
* v4 V' R) S4 M- G* A4 C0 a , \! P3 q1 |/ W8 S: H% c& i* i- b
try , r7 B# O. P$ @3 ]7 a
{
0 G' v& u0 d, ^ // Enter the path to a model file! 4 Q- @/ b5 y J. u3 n' [, Z/ @1 t
simple.LoadModel("C:\\Models\\Test.spp");
! U- ]6 |* l) Z1 X" V+ L; U0 Y}
3 y1 q A: f1 _catch (e) ) g$ f# l. J1 J& p% h; \! R
{
* f# V0 x/ L, I" i' C1 P5 z$ S WScript.Echo("Could not load Model!"); ' D* J1 ?! E* S; _: X: B4 k- j
WScript.Quit(); 6 k; d9 O! @4 W
}
, y) U& Y: }+ S$ F5 }$ X; D
! W5 v9 |! v( v3 i! Z! S( atry # P2 x, d) q3 c' y+ I
{ / J2 H/ [- O) V$ X* J
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
8 H0 p5 c) s! B r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); # o: y7 j6 P4 i8 [- v" y. W
if (r == vbCancel) 0 z3 w& U8 M" O
{ 8 |, c& B( c- G C( D
simple.CloseModel();
! w7 n @0 Y3 k+ C2 \. r WScript.Quit();
& {5 T2 u4 u% z, @/ v4 i# `; p } 6 p5 |: z2 \1 y6 ]/ {# ^. c
} : Z) s* K$ l- s2 w* V
1 v6 E, ?; y1 z# W' H' u* jsimple.StartSimulation(".Models.Frame.EventController"); 2 v! y- p0 C- `4 l0 _
: W! q" K: H! t8 ^% e
if (simple.IsSimulationRunning()) 6 r+ A' S- \3 B Z
WScript.Echo("Simulation is running!"); 8 r7 L" x) H, U4 \$ T
! T# ` j$ U0 S# w// Wait until simulation is finished ! N& `- S& h. r; I. `
while (!Finished) WScript.Sleep(2000); " f) G$ `( T( u) Y4 L5 P6 x
9 f+ J! a' k) _$ R7 R2 Qsimple.CloseModel(); $ @) r* C/ `8 g) `3 c
simple.Quit();
& G% Z3 G; x. ?+ r, q+ MWScript.Quit(); ; v' g9 I/ y- W7 Q% q- Z
1 S g$ ^/ e. A; X1 X c! d; ? + ]. d3 k- W$ D
function RemoteControl_SimulationFinished()
$ s; Q' ^; N( ]4 h6 Y2 r4 h{ # @ \2 ?( F% Y" L$ O
WScript.Echo("Simulation Finished!"); |