Example of a JScript
4 z1 {5 y. D2 g; |var vbOKCancel = 1; % H) W: I9 q% D: J1 A# P
var vbCancel = 2;
1 ^/ a' s" s3 U p: E7 ?' x3 ^var vbInformation = 64;
4 v! X8 h$ O' ~ S5 Rvar Finished=false;
- D9 I2 f1 v1 y& I2 w+ F- c 3 l; i1 c) F6 e. e/ m! c2 _
var WSHShell = new ActiveXObject("WScript.Shell");
: X7 E/ G" g6 v8 }' `# [ # }) A" j: r) p7 {
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
. V/ e* X1 z& k6 O& m " ]; q3 {1 ?- y5 v1 m e7 F" U" E9 C4 }
simple.SetLicenseType("Runtime");
/ F- s4 i6 ~) U" k2 k+ K7 a/ O $ n- }& `$ `: W; m! Q. X9 g
try
6 T0 o0 a+ Z/ [: |{ 6 j' V, U, p" h+ C7 @4 i: L
// Enter the path to a model file!
$ m8 |1 y- l$ g+ T" \- G! q simple.LoadModel("C:\\Models\\Test.spp"); - o+ P! V6 O1 P! q2 d9 ~2 h
} % F+ n% t: W0 u# Z+ \, L2 y6 g( ?
catch (e)
% \) c! f$ v/ o3 s/ G{ 9 R/ j' v/ T+ n( H* Z+ }
WScript.Echo("Could not load Model!");
7 ~) J! d# \ M WScript.Quit();
' l1 [& ~5 Q9 u( K}
& a8 j! X( V3 b5 e, |
7 m1 N5 B6 k! q: |% U$ Utry
9 g" Z; D& ~# \% U# z; O{
% V; b4 n/ T4 b* W1 ~# Z" Y simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 8 Q/ p" b0 s" h6 a+ R2 p
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
- P5 R' B: U$ h" w, B if (r == vbCancel)
$ E! r6 Y: o# G. H2 `& q' Y! i' h& y { + E$ J# N# g: A: F( h3 ]
simple.CloseModel(); % _+ @0 C' ~! _5 I5 X2 w8 s* A: `0 S
WScript.Quit(); * b# [" e: h- U: z: z' C
}
! x% N# a2 ?$ X7 ` l3 a} 4 [5 x, w; l4 A$ v! ]- u& P
5 G; u# e6 ]% s+ l
simple.StartSimulation(".Models.Frame.EventController"); / Z8 m8 ~" w5 k& X' Q/ s
) A. y& R# t' j; h
if (simple.IsSimulationRunning())
9 J8 F- T( l% v9 Z$ b- _ WScript.Echo("Simulation is running!");
% r d7 U6 }( e+ n2 q
7 y" c+ n1 k& y( r- U+ m// Wait until simulation is finished
0 R2 k/ U& y# p# n+ Swhile (!Finished) WScript.Sleep(2000);
2 D( g5 E: p0 ]
9 i7 M' N& ^6 u9 i4 o8 ysimple.CloseModel(); ! i7 Y! Y3 M; O; H: a; t6 Y" D
simple.Quit();
9 p/ n7 `2 X. e7 ^ qWScript.Quit();
f$ T* b/ c, X 1 c2 Y7 v9 i# L( ]) L
8 m, R P3 j! R! c! r' c
function RemoteControl_SimulationFinished()
: H+ H5 j, w7 r$ J/ e{ : g, F9 w, a7 B c
WScript.Echo("Simulation Finished!"); |