Example of a JScript
. p. M" I/ E$ ]% x3 y9 |var vbOKCancel = 1; 3 @9 X0 H5 F. s, X" a q" G
var vbCancel = 2;
) ]& ~: S; @) O% G" Uvar vbInformation = 64; 9 e% ^, D% {3 Q# k
var Finished=false; : v+ }, L; L$ n. L
! \8 l$ C4 S7 P
var WSHShell = new ActiveXObject("WScript.Shell");
8 }) Y" r: h4 ?4 v; q5 B5 | 2 ]- s" t4 @& A9 r& J! }* m
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ( Y6 E3 F8 R$ o2 E6 B/ L% n5 I1 b6 k; ~
6 l2 ~0 d0 \; {9 psimple.SetLicenseType("Runtime");
, m) [0 k' L, P3 N3 d* i 9 h$ g" E3 U, C
try
" n5 l- D7 y, O{
" a+ M+ {3 q7 r8 k% T: ~2 K // Enter the path to a model file! * w/ b t* R3 R+ D, F
simple.LoadModel("C:\\Models\\Test.spp");
4 S( \# T) |9 X/ [7 t; k. m* e1 S} 8 g0 v1 B+ ]8 _. a t/ c% \3 \
catch (e)
7 E$ u a3 k% @{
/ I' S# z& X1 e( s WScript.Echo("Could not load Model!");
6 m: Y8 ]2 ~" U2 l' w) u8 m3 Q1 z WScript.Quit(); # N% p2 }; m `) O: P0 X
} 5 O/ J& T( T) [: j3 z9 X- [
3 Q5 ?# w7 W: _4 U4 U1 rtry
4 _% |; i, s5 ], t: o{ 4 C! Y, r* f/ `- e* B
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 5 E$ A/ W. L# n& t, R# T/ D% |% {
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
& l& q" r- _$ N3 M; {+ \ if (r == vbCancel)
& u" i) C! W; ~" o { _- Z i% _* v ^
simple.CloseModel();
8 N- G" \2 C! q6 }5 N( w WScript.Quit();
: ?/ D ]) w9 R! c }
- o* @% i: V1 F' a2 ?}
# _2 U6 D" p8 O O/ W9 }
5 G) x$ {/ Y+ u# n. ^simple.StartSimulation(".Models.Frame.EventController");
5 b: u5 r) k H5 d2 F" ?
( B% A- m7 U8 O0 w& x5 j6 ]if (simple.IsSimulationRunning()) ' a( g' u7 m) }
WScript.Echo("Simulation is running!");
8 h' X' s% _! z6 m1 k9 r2 n $ Q! h3 {' }) O! x3 J
// Wait until simulation is finished ; i! W: a3 }7 b& a0 \# l
while (!Finished) WScript.Sleep(2000); & J/ C* b& B0 q7 _& M0 D
) Z. Z" }; r: Y% I, j) s6 Gsimple.CloseModel(); * ?, ^+ j: ?$ d4 _3 R2 a' i2 x ?
simple.Quit(); 4 ^% U r2 R: ~* S/ }: T
WScript.Quit(); # G" Q9 }1 I& U9 I0 l- f9 h5 T
. m/ K7 l+ `, m- ?$ k% v, S) Y/ ~
# R. l% o1 x: b; D$ u( r
function RemoteControl_SimulationFinished() 1 ]& U" ^ D7 U0 F/ y; i
{ 5 ?/ e. |& t) M3 f7 m: _
WScript.Echo("Simulation Finished!"); |