Example of a JScript
( ]5 p: a4 ^& X7 }3 ?2 Y" Nvar vbOKCancel = 1; & v w- I% l8 l- c( n' e* w
var vbCancel = 2;
- ?% B7 H+ t: Mvar vbInformation = 64; . Q- X8 V4 P$ }, F4 i6 q6 O
var Finished=false; 1 E/ s5 u$ d' e6 m4 m2 Y
# t5 Y: C \" z0 p1 M3 J: ]var WSHShell = new ActiveXObject("WScript.Shell"); - }! H+ |) P% B7 H9 ~$ Y
" w! _5 e. J) O) y' g5 J: D4 O
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
# o; W) ]0 u" c* D( ]) m |1 L: C& C& i) x& Q( A1 @7 G
simple.SetLicenseType("Runtime"); 8 \% B* `; X, d4 W
7 d$ q! g) {) f+ ltry
# d) x$ r% n8 w{ - G6 P, Z) Q# U" |
// Enter the path to a model file! " p$ q g3 ~1 E: Y1 H
simple.LoadModel("C:\\Models\\Test.spp");
$ g( w8 b1 f; E$ o a/ {: e& r$ Q} ! z" H3 m$ g& t4 @
catch (e)
3 V% y4 V: k, h/ u$ T{ + o) c+ n9 v/ v H" _
WScript.Echo("Could not load Model!"); ( w7 J2 u- z" X* i+ z @
WScript.Quit(); ) A$ m7 y- V: q( N0 K4 t t* Y
}
4 ~: D2 h7 L; {$ q! a! ?3 A- [ 4 c, J# Y- S+ E3 T) x3 R
try z! D! J* J `9 q7 E7 V
{ 0 X* |7 \6 Y5 `2 J3 W* W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
, x# `, p& ]* J, E& v5 u r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
7 {! y6 u8 G8 m `0 g& z if (r == vbCancel)
9 R/ t7 B: J0 M: \- L# K {
4 H& K3 S' H& v7 e9 _ simple.CloseModel(); ; Y7 ~+ q! }! d- s/ g
WScript.Quit(); 8 a, p+ n; t+ H+ `; r2 K6 [
} / y7 k- S J1 m Z
}
" l! t% J8 ?% M. @( K! p
9 i/ w1 V) J4 Usimple.StartSimulation(".Models.Frame.EventController"); * g. o6 z) _+ b. L; p5 V
( P0 ]- g p9 d8 a/ T! g. s% h
if (simple.IsSimulationRunning()) ( ^1 E8 z% |* ?* C. ~2 h
WScript.Echo("Simulation is running!"); & d# m# U" y6 T4 }) J. N) f$ c
2 W. a3 A/ P M5 y# N) K2 C4 O& F// Wait until simulation is finished 5 f$ y2 _9 C- A! i7 ^; W
while (!Finished) WScript.Sleep(2000); 7 s; b: |! @$ x1 k% Y
7 J: R2 b4 C. I& d5 T9 w. p: S
simple.CloseModel(); : ^" t9 L& t- {4 E1 I" w
simple.Quit(); , i8 D; w2 J5 F# b5 R
WScript.Quit(); ) H: x/ `. h* W# f
& ^5 I2 y% W5 S3 ~0 c
8 I+ |% l# g% y3 {2 `+ @( }
function RemoteControl_SimulationFinished() 6 x; G% U* w( G
{
' w1 I- a. V- ^. [3 N- n- N WScript.Echo("Simulation Finished!"); |