Example of a JScript 8 a; Y5 F+ Z/ F) P
var vbOKCancel = 1;
# x; t; {! R2 c. mvar vbCancel = 2;
1 J8 A4 T. U0 \var vbInformation = 64;
6 q; k/ L& a1 T# Q$ u0 qvar Finished=false;
: A1 o/ `0 S* q8 U
( H$ g$ T% t3 q0 c8 q& m( \var WSHShell = new ActiveXObject("WScript.Shell");
. S1 l9 B. G4 H% P$ v
" E5 O; M- E6 Uvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
; N7 [) x. B/ y* d( R* U ; V- K+ ?3 ~/ n5 U3 `
simple.SetLicenseType("Runtime");
7 d C( Z+ k! I+ u
+ L1 X- ^/ Y- jtry 5 ]7 U; ~5 D7 l6 c
{
: ~! L3 M& W, s4 l. X. p/ a" K // Enter the path to a model file!
- k. t. @8 _% Y1 U simple.LoadModel("C:\\Models\\Test.spp");
+ D q7 w; ?" \& `}
?- M+ v: M: vcatch (e)
8 d$ U- r* f* K0 ]) n0 P) F# A{ , o3 E A1 `( ]* c0 U
WScript.Echo("Could not load Model!");
* W9 C/ q, y+ J: l: [2 f6 K5 P WScript.Quit(); 0 g( n( X) `6 ^
} $ b3 }. C# Q. P9 M
8 ^2 e0 r" c- _9 e
try
7 x+ a: w/ g0 k1 x* y# K{ $ B$ ~. K e3 [+ X m6 W/ S9 ^) b
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ; n e" b) q; u) e5 t( D1 [
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); - w7 q, g! O2 j. l, ]6 B/ o
if (r == vbCancel)
# q9 P7 [6 v1 J+ I { $ ?$ \4 c, T P4 B2 m0 U T
simple.CloseModel(); ! B2 ~( k9 j+ x. N
WScript.Quit(); + S+ _" p, w8 i7 g/ u
}
- ~. f5 t w8 ?& @5 c. A} * L; t. y& ~/ i1 n' ~
9 P" `' A1 V5 {. ~
simple.StartSimulation(".Models.Frame.EventController"); ! t! E% b7 f) }
" D3 M: z- g( A% o p
if (simple.IsSimulationRunning()) . K: A# F/ K# _
WScript.Echo("Simulation is running!"); , \) H5 S) {2 }
4 u8 F U$ p0 n4 n! _
// Wait until simulation is finished % j' R, u7 a: H7 } k
while (!Finished) WScript.Sleep(2000);
: H( G2 Y& K6 o: u$ h0 W. i& d
1 G7 | e0 Z, g. t/ [* n' _0 Tsimple.CloseModel(); . @& \' I$ S0 I) f+ J
simple.Quit();
/ D3 ^* i( r. t1 j3 oWScript.Quit(); + w: m$ U# ?9 F9 `+ g+ Y
, {- m3 F7 L3 r3 z9 i
# Y o: I! Y" m) F* j4 tfunction RemoteControl_SimulationFinished()
F& U) A! |5 x* l{
% X; q7 ?6 w4 e ~2 }& C WScript.Echo("Simulation Finished!"); |