Example of a JScript
6 [7 D, \" m5 Q, i- R* x/ rvar vbOKCancel = 1;
7 d6 A1 r0 I8 k4 o3 W, hvar vbCancel = 2; . p+ m- o# J! |& E4 c
var vbInformation = 64;
; Z( O& x- `1 ~/ }4 Hvar Finished=false;
' d0 B6 Z- s! _8 K7 m
/ Y3 p0 i1 M' N" o8 pvar WSHShell = new ActiveXObject("WScript.Shell"); ' `0 V: s1 m i/ Q; I- R; p
& b' f$ z6 [. E; x$ E, ` |" Y% Q0 p
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
: Z! K6 M4 G+ a) ?( @
- B/ f8 \6 n2 J5 `simple.SetLicenseType("Runtime");
% S8 ~( B3 _- s/ T8 T/ C4 a9 q8 A; b 2 \0 U2 F+ ?3 Z4 ]7 z! D" H
try + Y% v( G" O( [) U% w. L8 B
{
2 O2 T0 S9 [3 B2 Z // Enter the path to a model file!
3 e ~ m* y& c5 N4 V simple.LoadModel("C:\\Models\\Test.spp"); 9 U! o" V+ I& q) \$ X$ M; V+ K
}
4 i0 b9 p X: tcatch (e)
5 b$ C7 a* m1 Q8 X. p! A5 y{
7 C+ _5 U7 D$ N WScript.Echo("Could not load Model!"); , P" E3 Z+ u' M' ?
WScript.Quit();
- M5 @( P! d$ l1 s}
* d2 N) n# s& P* k7 U! T2 W , S9 {' m7 `: z- b( ^/ e
try
* ?/ c( C% x' H) X+ j' I; h( G% k{ + O# X8 ]) I: e" }; _( Q/ B
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { / E: p7 Y4 d! }8 q: S. h& p) K8 ~8 V
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 3 }# a0 `8 M+ O; p& f9 Q2 q
if (r == vbCancel)
- e8 v$ V4 t! N { 1 J! m$ } k" r3 O/ a' O) r" _
simple.CloseModel();
, H4 G! Z m/ b x WScript.Quit();
3 t; a5 L( t m$ S2 V4 e$ l. [# Q } ) b7 L" x( j1 A- u$ v( B# `( K
} 2 P" y+ G) l% M4 g/ t
- k; G) H: y0 L6 b4 Ysimple.StartSimulation(".Models.Frame.EventController");
4 ]* n$ e: p' z' a0 l# H1 L
7 X; Z/ D3 f$ t3 P+ }7 ^if (simple.IsSimulationRunning()) % b, ] e! L( l; y2 R0 f/ |% H
WScript.Echo("Simulation is running!");
: r9 u. d* R$ |3 }' W1 U& u
/ v }9 k L- u5 k. k3 k// Wait until simulation is finished
7 q6 {8 l, |, @1 Fwhile (!Finished) WScript.Sleep(2000); : i d* l$ Z' h3 N
& f; c$ M, X1 w0 K5 K
simple.CloseModel(); 4 J2 E, m3 Y9 d3 U2 P% Q( f' J
simple.Quit(); - y: i# G M. y
WScript.Quit();
' s* r- J! l( h$ j+ C
p7 c6 E, G( R6 y. m; K6 C" R7 ^ 6 P( g- j! L% q; N9 o
function RemoteControl_SimulationFinished() 6 Q! J1 Z2 }7 G
{
8 G- ?1 @" c% ?6 r WScript.Echo("Simulation Finished!"); |