Example of a JScript
8 U- D( w7 @* i) F* K& ]var vbOKCancel = 1; ( f4 u* S$ @: [% Q; w4 a4 k# X
var vbCancel = 2;
) ^4 h2 J. O' J# N. \6 ]% ]( Rvar vbInformation = 64; 8 V* n* q; X* I# K8 ?
var Finished=false; 9 g7 I$ _* U" y* U. y
) t$ a: v. `: t3 ]# f5 R
var WSHShell = new ActiveXObject("WScript.Shell"); * D3 C* w% u- ?7 R
: o: v+ d" X5 Evar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); 5 l/ a! Z/ ]; m9 ~3 n* f1 M+ E8 h
1 _0 O, O( ?% O$ {
simple.SetLicenseType("Runtime");
3 V: E* r; [- } G
& i5 U" w1 F& k) e" J& Q R" ktry
) x x: [% h5 D, V{ w( V. H1 I; f: z
// Enter the path to a model file! : _$ K. ^% S3 U1 j1 @2 w( `
simple.LoadModel("C:\\Models\\Test.spp");
* m7 q! w2 B6 c( Z; _}
/ x6 x' L& i! b xcatch (e) + ^+ ~2 p9 z9 I/ p6 P2 [
{
' Z( i" `! @/ _) o/ }: O WScript.Echo("Could not load Model!");
; W/ _5 S. p7 l. q WScript.Quit(); 2 T4 m- c6 G W/ {" G( l* d2 t
}
3 r/ i* S0 K2 k# H9 A j S - M% U# A# |" t2 p1 g; c
try
u7 x$ q( ^, ?: ~. C2 b6 R{
0 b3 q# c! G8 _ simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
+ V r e$ d8 k7 J, J r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) g, z+ g' ~; ~# y: s& d
if (r == vbCancel)
1 L# E$ `$ m: d4 v7 Y- ^* q9 O {
) u0 W" T% Y, l# ?/ Y5 ? simple.CloseModel(); 8 H" I; y5 L8 x8 M# ]9 \# f+ o% M
WScript.Quit();
+ k2 q/ H% K4 U& [/ t } . G% k# S w0 S' J. C1 s0 Z- K) K
} 6 n2 T) c& N( q/ w/ p! Z
+ `) H9 ]' E' D: G0 J0 Jsimple.StartSimulation(".Models.Frame.EventController"); 8 I0 W! e/ q- B. B6 x" o6 T: I
4 \0 m, E6 ]) {' `# w$ `+ S
if (simple.IsSimulationRunning())
. l, R( s1 A* }; f5 [ WScript.Echo("Simulation is running!"); & }- z8 N/ Y% T5 ~) B
( B. k5 e3 V: ~
// Wait until simulation is finished
: y9 D/ X, n: N( R) hwhile (!Finished) WScript.Sleep(2000); & V* [' }% m) `1 F8 z$ z" K
! K! {: `( [2 h
simple.CloseModel();
& s1 T1 G' }( U7 M Osimple.Quit();
' r8 i# Q6 s L5 T' R: U! rWScript.Quit(); 7 n! x" e, M/ U
* C8 \0 T9 [' z/ u. {/ |+ n2 R, p
0 {2 X( b! R. i) r; r/ U; {" dfunction RemoteControl_SimulationFinished() 6 y* [; A, g! p* L) M
{ $ z/ E, a. C @" P+ h0 s
WScript.Echo("Simulation Finished!"); |