Example of a JScript
6 B1 I2 ?' `/ Y# dvar vbOKCancel = 1;
N1 K3 p0 @& A' y, O% e ^var vbCancel = 2;
9 ^ X+ d, d* U% q. J6 e9 f- Kvar vbInformation = 64; - x1 o8 ]5 l! Y3 O* }; l8 p
var Finished=false;
7 b! h$ W7 R! v, b) H
H$ f- r" H) D. D& u, nvar WSHShell = new ActiveXObject("WScript.Shell"); 1 [ }2 U" _, A0 Q" L
6 I- G+ f# B R& c2 J$ V4 _6 P& }var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
8 t0 q1 ~ e. o* d& w % Z5 A" C3 m j. U$ H* F
simple.SetLicenseType("Runtime");
& Q( t" {( j$ C. V$ n e/ b- g . Y: a1 L e( _9 S y* r
try G, t8 `. V$ w
{
# S6 M8 W3 O9 w! t4 ]6 B // Enter the path to a model file!
, A# Y" u2 ?& v simple.LoadModel("C:\\Models\\Test.spp");
4 [( \1 j! G4 g6 i} ! k) V8 }: ^+ |$ Y6 Q; T
catch (e)
4 ~# n4 x1 d' T: _) d) K9 @& r* i{ & j5 g; Y$ R2 w) R
WScript.Echo("Could not load Model!"); ( \& j2 Q3 U e2 K$ Y0 |
WScript.Quit();
4 q/ Y0 O$ {7 ~7 }; ^1 ?} : `- L" @5 E% K
: H- u4 x8 p5 E6 U3 Otry / c( B, g( G% |, P4 `
{ 2 q; }1 r: {; N; }6 d
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
5 I( K6 @8 W0 p0 O2 l3 s r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
2 p( F6 O/ r) Q. t if (r == vbCancel)
7 G& K5 ~* R' `7 c! U+ y {
+ S7 b+ u: W) p* y simple.CloseModel(); + _( C1 M/ F& K3 M# ~0 D
WScript.Quit();
8 Z) L' O, j) A7 F. n# [- d }
3 `% U v: T& }, k4 z [9 k}
7 g0 |% s3 o/ V$ ?# S8 k4 m* a) a 2 L/ p$ M; Q7 M4 F- L" C5 m5 {9 |$ S8 c! I
simple.StartSimulation(".Models.Frame.EventController"); 4 }2 b' e! h9 [! m8 _
9 {6 Y! V3 E6 Y9 @
if (simple.IsSimulationRunning()) / r1 M6 c! y: ~
WScript.Echo("Simulation is running!"); 7 V* [. i9 H3 x# T( R
4 s$ r: B4 G5 h' S- C P7 `
// Wait until simulation is finished 8 o: H0 p" H+ m8 T+ I$ p
while (!Finished) WScript.Sleep(2000); * N- q2 ?. }9 o2 d, O: c( z
! L% ~7 M6 X4 \6 M+ xsimple.CloseModel(); # \# G2 X$ Y5 o+ P
simple.Quit(); ( v( v9 }- `' A
WScript.Quit(); ' w+ X, _& u0 }, o4 I& ^ q
" V9 c/ D- N4 u' q4 w2 \. T2 x
% m% h2 }+ f0 |( _* g1 hfunction RemoteControl_SimulationFinished()
: A' Y/ Y! v( t( Y, I8 U{
9 ?4 D% y' o* U0 G7 w WScript.Echo("Simulation Finished!"); |