Example of a JScript
4 }; k4 _3 l' E [; z- q, a5 evar vbOKCancel = 1; / q d5 I& p/ x. m9 v
var vbCancel = 2;
- G) y) O: M% b+ d2 H& x5 yvar vbInformation = 64; ) `) E1 m2 z' e: q v( D" G! G [
var Finished=false; & M. o4 b' x! g* n" z
- }% |4 j2 q' w* W5 ?2 \
var WSHShell = new ActiveXObject("WScript.Shell"); 0 W; z7 a+ v S7 p) g L
4 y% |3 H( j, |var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# @+ n# m+ K$ K6 P V7 @* N# ?+ p& k
9 J+ H" a- c. b5 ^( @simple.SetLicenseType("Runtime"); # \5 j& O2 J# R
% E- | T8 g* N! X. _( ~: R
try i6 a, j" Q) Z' {* y$ m
{
/ b! D# I! `- @3 d0 b, V/ Z8 f6 T // Enter the path to a model file! 1 }' ~5 p) W, v# [ z+ m
simple.LoadModel("C:\\Models\\Test.spp"); ' g- B! q# J7 p8 a
} 5 \ E: M( F% G2 U/ K
catch (e) - V, d- G4 O% D5 M2 V o K
{ $ R+ t: }: f0 {* X$ M4 z: |1 q
WScript.Echo("Could not load Model!");
" c4 c$ I9 N3 ] WScript.Quit();
0 R/ E3 |5 t9 h& p9 P8 |- U}
6 _( j9 S5 o; N# Q q9 @) M0 `* w0 L& x
try
6 u. H/ [2 a0 x$ V3 S' f/ v{
m4 U* [0 U: d- R) E C# {% } simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , c) ?# ?5 k" G$ k
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
9 s) m# g r( y9 ]. x if (r == vbCancel) + T. B$ _3 H) }2 x1 B
{
9 e8 }9 p l D, X c- A0 O+ a/ u simple.CloseModel(); " w. D: M0 `6 N+ n
WScript.Quit(); 1 x& q e4 l( W/ [ J4 y3 E9 q5 h$ w9 S6 p
}
2 O1 r: _) `: [' m. y* d+ m} ( E# C/ l, d2 K, }$ y: Q
# I/ t: o, T! g+ [6 w
simple.StartSimulation(".Models.Frame.EventController");
: y( } B# w) S
. O0 ?7 a% S' ?8 z! [) eif (simple.IsSimulationRunning())
0 [9 m1 z/ E3 Z& i WScript.Echo("Simulation is running!"); % s8 |: D! E' d* Q
1 p/ N- r- A3 I2 x- d/ M
// Wait until simulation is finished 1 G. P2 E* | Z' F+ r$ j- D9 T
while (!Finished) WScript.Sleep(2000); * A+ c3 j v! i, d0 t: n1 Y" W
4 D4 A" L4 q+ _+ M* b3 x
simple.CloseModel(); ; S" j1 b: ^0 \% O
simple.Quit();
3 L! f" k+ w7 h$ _6 U" r; _WScript.Quit();
' n$ U) c4 L( V: V( O: z8 P2 Y' e d l1 S7 W u' S' W
' F/ L3 b6 Q0 ^4 Y) B- n
function RemoteControl_SimulationFinished()
; g l M# H+ u) C& [. s4 W{ $ U7 I/ h2 G# L% G2 L9 O
WScript.Echo("Simulation Finished!"); |