Example of a JScript
L" L# E% \0 h5 S# [var vbOKCancel = 1; ! E) F$ [; ^1 f7 @6 j" P
var vbCancel = 2; & r1 m. A. j: V7 ^$ d* J) J" F' i) }
var vbInformation = 64; ! Y( b& T$ X# O
var Finished=false;
7 U) ]( e; G+ ~9 p& B
/ m) a6 i* i! R: G- X( a: Ovar WSHShell = new ActiveXObject("WScript.Shell");
/ u7 |% V1 ]1 @8 R8 v
8 O/ \. w( B ivar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ' k: i) I* F8 Q8 c& h1 g) l+ d
+ D# y$ ^4 r: I( w
simple.SetLicenseType("Runtime");
6 _. E% r% S: M6 O: S - Y+ j# B1 Z: n* x+ @2 w% K, @! ~" H
try
1 A4 M. _! m- D2 ? A3 L0 c1 V. R{
o9 ^3 t8 C* q% n // Enter the path to a model file! : g1 e. Z: r8 A
simple.LoadModel("C:\\Models\\Test.spp"); 1 w, p% l% W+ [
} 4 M0 O% J8 s9 Y
catch (e) ! h+ ?( Y4 ^1 \# K# @; B* d% v
{
4 J% U6 D& m r- J4 e WScript.Echo("Could not load Model!"); $ {& O9 d- r# O. T8 b
WScript.Quit();
$ B- n3 {1 J6 ~4 e4 |}
7 h+ @* U$ x4 T: v# F
% ?* d* p. [/ V: I! u0 |try 6 ` g" v+ i* n; G( G9 P7 I
{ 6 L& ^9 O9 i% m
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ U" X# o/ W6 v) {6 X1 Q: O r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); 2 r3 z) F+ H7 ?$ \$ U8 R
if (r == vbCancel) # ~# y: r! X7 ]* }( [
{ 8 Q- b8 t7 f+ r/ Z& Q$ z& `6 Q
simple.CloseModel();
5 R2 d+ U$ T2 r. k6 q% C& j: U8 ` WScript.Quit();
) v8 T6 L6 s+ B# i7 L) X5 s( ?9 n D }
/ o; i y! x2 H1 D& ` M} 4 A0 z1 b/ n% f# i- B; l. \6 G
5 [! t- v& b0 m" Q5 Ssimple.StartSimulation(".Models.Frame.EventController"); 9 S6 B! l1 x: E" E2 Z: Q
- o: l- L+ d/ O! Q7 S5 |" [0 x
if (simple.IsSimulationRunning())
- j9 W0 ^$ F& w! Y& \ WScript.Echo("Simulation is running!");
# K1 r, ~/ g; s+ D( M; z+ B% R% ? ) n$ l B6 I" R B
// Wait until simulation is finished ; |% z# R, r# T- Z8 v
while (!Finished) WScript.Sleep(2000); 1 R: ?/ h' h; l/ [0 J
5 k+ ?( p) u! p6 N5 W2 d3 W
simple.CloseModel(); # f% U7 J4 ] a
simple.Quit();
' c/ N5 G/ N" BWScript.Quit(); & @) G9 O8 ~7 S/ J& s) \
( a& A. O8 s1 r 2 e( e* t1 y" B: o) t
function RemoteControl_SimulationFinished()
7 {: Z" M( _4 t7 L, r' A{ 3 b, n9 C+ H( t9 A4 l, Y- D
WScript.Echo("Simulation Finished!"); |