Example of a JScript . ^" I" I' V; U" A N1 w/ A) b
var vbOKCancel = 1;
! V" D1 E' d q5 r) svar vbCancel = 2;
s Y6 C( x5 P* } Q2 Dvar vbInformation = 64; ( w( Q8 p N; ^! k/ i4 L* z
var Finished=false; . l2 r _* U: S$ x3 y9 x6 c6 l4 C
) B) E0 Q, ~/ d; \9 Hvar WSHShell = new ActiveXObject("WScript.Shell"); 8 e9 Z+ \. F7 V8 l6 |" v
& P1 F/ |0 H3 `3 A' S' h& T
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
2 _6 c/ b3 X# m 5 S3 T, u3 H( f3 J0 M
simple.SetLicenseType("Runtime"); + m' x: T/ d3 V4 Q9 Z: P
, m4 Z% \$ S& O9 ]- \$ l6 X. x* {try
' f2 B# O* d+ q: m/ R& S{
- _4 F/ T8 x* C // Enter the path to a model file!
' Z7 Q! ?3 M8 X% R. m5 o simple.LoadModel("C:\\Models\\Test.spp");
o/ `$ T" l" V# l} 7 c1 c2 D+ r: U0 f/ [" ~
catch (e) 5 E1 i8 _- T* j- ]' N& u
{ ' L) j- A: K0 K
WScript.Echo("Could not load Model!"); ; z" f7 S( @" y* {! w
WScript.Quit(); 0 H' ?0 z7 |% A- ~( ~3 l# s1 K
}
4 ^3 D8 ~4 r% N- l, L( c/ j& r
- |1 T* D5 t( {try ) P0 n4 B m" g c2 B
{ $ I$ [+ x) R% ?/ K, t# l3 n5 r
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { $ p5 c2 @" ~9 s% k/ W2 N
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! C0 K" b. |) z1 U, N2 G6 ?$ {+ q
if (r == vbCancel) 7 T1 b3 e/ c( Z- @# i. m
{ # S" s: m( i; F
simple.CloseModel();
3 [: ^; {+ D& p6 G1 ~# `: v1 Z WScript.Quit();
& l! A" }8 _/ S }
, s2 m4 J) h$ Q* ~}
& z a& e+ a; o - a- a8 H% e# Y! F9 R/ g
simple.StartSimulation(".Models.Frame.EventController");
% y: v% ^( Y3 O" r6 ]1 n
8 L" V+ h+ \$ V! l3 d+ m, E. Cif (simple.IsSimulationRunning())
; c% P5 E5 q5 n) {. X7 N6 H& d WScript.Echo("Simulation is running!"); 6 X# J1 L' ~: W6 w0 ^; f% m
6 b" f+ f. P2 d4 h7 U; ]// Wait until simulation is finished * z) ^2 }0 D+ X& ?
while (!Finished) WScript.Sleep(2000); : H1 g+ R# ~* @3 L. ]
9 C9 Q9 T" {! i6 ysimple.CloseModel();
3 o7 W& h9 g) n3 |7 S Psimple.Quit(); 4 d8 E4 {+ }' B, Q. U9 j/ U4 \
WScript.Quit();
. z$ P' a. J% z , b5 Y! t, w" a7 v2 s: F
8 ~1 P7 J& O* l9 n( K% y
function RemoteControl_SimulationFinished()
% C `, O+ ?3 o) \- ]) G* F8 r{
, H" d3 J7 ?* J! e5 X WScript.Echo("Simulation Finished!"); |