Example of a JScript * w3 z9 {% V j
var vbOKCancel = 1;
) @1 u( W2 A9 m: C3 D3 ?& Xvar vbCancel = 2;
7 U; C8 x+ M+ f8 Pvar vbInformation = 64; ' h; {4 ]+ ?# S# g! O6 E- `
var Finished=false;
9 D, X( |. q# M" h! A8 N/ ^ 8 u6 Q. ^6 P0 r) x. K5 `% A
var WSHShell = new ActiveXObject("WScript.Shell");
% v i$ m6 j0 M S3 a1 O% a5 ]" M
3 W& `, R5 w: x" Pvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
4 w# W: H3 q) a' @5 r6 D6 P) y# I! i
$ U6 D) g; R, t; N: O" T. Usimple.SetLicenseType("Runtime");
9 l. @& G; r1 U, e" {- v; o, f
0 E- A( X1 ?& l5 \- l8 u7 x5 A Ctry : C+ z0 }+ N, { |. a! l1 c' z3 A
{ 2 I, t1 L1 X% \
// Enter the path to a model file! " u N! g5 s. d7 O/ r5 l) d% O
simple.LoadModel("C:\\Models\\Test.spp");
' A, X3 R: N; M2 F5 q' m}
4 L, R: j7 q: m- z# H% D" ycatch (e) 3 q) T2 D7 x0 J4 H) S5 P2 f7 f
{ 9 h# v0 i2 X( h2 O. S1 o/ ^
WScript.Echo("Could not load Model!"); x* l; \+ a5 ?2 P$ Q4 x6 n0 H( B
WScript.Quit(); 6 ?1 [, w7 M. i, U, f- Y- u: S
} ; `( C9 g k$ ?1 ] O/ d" G1 ~
$ ~1 u" Q+ i0 i# z& ^; Y
try 0 [ u& c/ c6 s/ Q
{ $ B! {$ D8 m& }& K" L/ H5 E
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
& G$ C/ O+ s0 Z. x6 T- ?3 U r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! ]1 g: C( @- F( z }+ S# I
if (r == vbCancel) ' E& G! a* o1 {( L8 q
{ 8 Q0 C" x& f: Q4 t
simple.CloseModel(); % x+ D1 K0 ` l+ D+ `2 A+ e# }$ K/ N2 Q
WScript.Quit();
9 Z3 X% E C+ r } ; |' Q; i% `, Z; m9 I
} 5 r4 I; |9 s) b& [
8 l; q& ^3 p* S; b, l) J* U
simple.StartSimulation(".Models.Frame.EventController");
7 \0 P/ ]+ e; z0 W- p+ U
8 a, Y _4 z* sif (simple.IsSimulationRunning()) 7 p1 i8 q' w, Z. j6 a, C& b
WScript.Echo("Simulation is running!");
5 Z1 ^5 v$ i/ H- X w + e6 p$ P! v! d
// Wait until simulation is finished ! d: W. Q; [) o. s5 B
while (!Finished) WScript.Sleep(2000); 9 S( r! O# {4 x9 h1 F6 Y
# {! ]! J4 _! ?9 Tsimple.CloseModel();
! {' Q" N0 F, b) f% Asimple.Quit();
' ?; t$ F; j, ]# v" R3 EWScript.Quit(); : [; |7 r$ h+ W. v2 v5 E
2 G0 W0 t i6 K6 g+ }3 W 5 x3 L* K, T9 ~
function RemoteControl_SimulationFinished()
$ |' f, H$ y# }: ~, S# w3 n" e{ # _) w) e* x& b2 }% a. x
WScript.Echo("Simulation Finished!"); |