Example of a JScript
) q8 P5 ]% d) q A$ O- zvar vbOKCancel = 1; : g( k& i4 U+ q+ z+ B. N+ i B2 F, A5 d
var vbCancel = 2; 4 ~- c( f( n x0 N8 E
var vbInformation = 64; % u9 F% P4 N9 t9 U# ^$ Z" i
var Finished=false; - R; c) k/ ^! `( _6 ]( x9 g
$ {5 }0 c' b% G$ N
var WSHShell = new ActiveXObject("WScript.Shell");
* e8 B* f& C# I8 Y1 Z# N2 J \& ]
5 O7 F3 `, _1 P1 G0 H8 t$ avar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); # H" ~3 v$ F" T% b: y
3 h& Z, r2 V* {' `3 A" _& z: e! V
simple.SetLicenseType("Runtime"); 4 U8 l/ n- K, d+ `/ f3 R
" Q' @+ N# Y1 U, M" \: a8 mtry % h2 B- J9 M- e- m8 |
{ , T" C1 P: S3 S* S2 A w& j% ~
// Enter the path to a model file! 7 [1 D- h, R* n: }- H a. z; x! E3 F
simple.LoadModel("C:\\Models\\Test.spp"); 7 X! F5 t0 z: n8 C
}
; y5 ?8 D1 w3 W P& Lcatch (e) ! b. u0 n3 K+ ^' t6 w% | `
{ ! m6 \" R5 \& I: `& V
WScript.Echo("Could not load Model!");
: Q( [# E0 j/ Z8 h6 [- [- B* I WScript.Quit();
* ]% R9 }3 j0 q% K6 h d} * o! G% {# S4 a2 ~
9 X; C! U$ q: z6 _
try
+ S* z% n/ w$ f0 f5 Y: }& o{
6 i) C' f/ b+ @+ G+ d" q4 N simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
* f$ d& u& N7 @7 M# z2 }3 K% D5 a r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
; k9 H& M0 }$ H7 W# I9 E1 G if (r == vbCancel)
2 G( e" D$ X& ^% [+ R- T { 1 Q/ n; H. r+ ?
simple.CloseModel();
% y5 l ]( F1 F" Z WScript.Quit(); ! ]" J+ b0 _! g6 q! \* x
}
2 v6 e0 M4 v2 I8 D2 Q} 6 a+ g% b7 s( d, _4 G1 r
/ J1 `# X9 K/ p2 v8 w
simple.StartSimulation(".Models.Frame.EventController"); 3 s b( p; g+ [
8 r! o$ c6 t1 B1 j Y. l* xif (simple.IsSimulationRunning()) $ Y( @1 J. {$ L7 a' G
WScript.Echo("Simulation is running!");
5 O) f, I5 {! M$ F# Z7 r+ q & J& n( E. O% P( u: A
// Wait until simulation is finished 5 g# J9 l8 W; [) s7 u G
while (!Finished) WScript.Sleep(2000); ( z5 Q) ?, o2 v+ H" Z7 `
8 w9 Z! R1 I9 c$ U0 w
simple.CloseModel();
2 ]5 m# u7 X1 S) p" I! N8 E" ksimple.Quit(); ' q& R& F0 ^3 B( `
WScript.Quit();
# r a' t5 O" {' c& F& M: s3 r5 a' a + z$ o/ d/ p3 l4 | V& G4 \8 a* E
N1 O5 o; A a, J0 w( qfunction RemoteControl_SimulationFinished()
5 y, }: Y, m, x i) x& D5 t0 G{ ' X: c& g7 Q$ C. ]! e( K. [- ^3 v
WScript.Echo("Simulation Finished!"); |