Example of a JScript
) [7 s: _4 O3 M& Y6 vvar vbOKCancel = 1;
) |9 ?5 e& l4 n0 M5 Jvar vbCancel = 2; , u2 h5 k2 H! T# _5 I9 M6 a6 b
var vbInformation = 64;
0 h" q3 c, c) o8 g$ yvar Finished=false;
7 E; y7 _, z2 n8 R4 M7 e # \" N3 H3 y' L0 ~$ X4 z
var WSHShell = new ActiveXObject("WScript.Shell");
( Z" p( P# M) Z8 Y' r
( @7 Z8 O/ H- a0 b3 ?& y1 D8 C+ c+ Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' y3 w% {4 {% Y2 `! O8 S
& x7 P* x2 v+ x' ~" `" |& Usimple.SetLicenseType("Runtime"); 9 }2 x7 y) o7 @1 j
; P+ ~6 P- v( {8 G( N M/ U9 gtry
2 ?: B$ v5 ^% n$ I' l" i2 K{ ) X, Z# t9 }7 X. {$ m4 g
// Enter the path to a model file! ) P7 I: @1 h3 y1 j6 [/ i- m1 `
simple.LoadModel("C:\\Models\\Test.spp"); 8 Y- P; M+ ?* I" r$ X! r
} 0 U0 }" H# Z' S
catch (e)
+ B" L. D2 f8 n- h8 M" ]+ @/ b1 \{
& Y! t3 D v7 | WScript.Echo("Could not load Model!");
0 X9 A; c' c, k# `+ \ WScript.Quit();
+ g, z! c- E6 X; f- n}
7 Y- W, G# P1 N; L3 v
8 c: V& L+ s6 v: u- N' @try 0 J, P" I5 i! I) z$ A# d
{
9 v. S' n) ~. J simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
: P" y: a8 J/ }0 s; w2 \ r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
6 ~) u& E& ~7 i3 p if (r == vbCancel) : L; L' A& a1 L; g0 s
{ , [5 H* D' }! g0 v# |) ]
simple.CloseModel();
# Q1 d+ y( p7 J6 D WScript.Quit();
6 P8 Q$ X4 `3 i5 S2 b- d } ( I6 w) l6 G; ]3 r* K
} 6 ]8 Z+ m Z* ]- ~' c- n* d4 ~
0 z1 T+ f' ]3 u! ~
simple.StartSimulation(".Models.Frame.EventController"); 8 ?" t+ h* b0 X# w
# j2 z3 {* F7 l/ u7 C, U8 r
if (simple.IsSimulationRunning()) - y1 b6 q' e; T8 E. X
WScript.Echo("Simulation is running!");
H1 z6 B' v. p% @$ n" u
- a, q- p- ?+ F// Wait until simulation is finished
# g, D# l# o! R7 F8 M* ~. Q; Swhile (!Finished) WScript.Sleep(2000);
; b: `6 K0 D9 Z) [7 O0 _/ F3 P: \* D
/ | }$ C# ? Q& j7 g7 x: [4 asimple.CloseModel(); 7 [* M: ?( w4 G4 A
simple.Quit(); " c3 P @3 I9 l2 w- O) t0 b4 C
WScript.Quit(); 1 }* y8 W! g1 [. O- K/ {
5 I& J/ t# H+ T3 V
! I# [: d4 g3 P( j
function RemoteControl_SimulationFinished() ) ~8 }/ P3 b# r- |- |2 j
{
+ Y. Y* X1 M9 V. X2 b WScript.Echo("Simulation Finished!"); |