Example of a JScript
' |8 r1 e7 {+ j# vvar vbOKCancel = 1;
, o$ u! o- }, h% D) f( B$ e% zvar vbCancel = 2;
M$ E# z9 K) E9 i! a! ~var vbInformation = 64;
u `2 D. g) T& V7 @3 ~6 q/ Jvar Finished=false; / Z( Z. l. U5 {0 F1 o
2 S: w- w, w0 e6 x
var WSHShell = new ActiveXObject("WScript.Shell");
; d" p0 d) W$ s( h4 x/ G( `% `
1 Z8 X3 V5 d* @; u1 m9 gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); ) |, d, w% D4 P7 i/ b
4 m1 ^6 q; P% Y0 W
simple.SetLicenseType("Runtime"); 0 \& t& ]8 }; W/ |# F( ]9 ~
( I1 t! ?) ?% C2 h: Utry
* F' m2 l7 J( v! u{
( B# N* h5 {. _1 T' k // Enter the path to a model file!
( v9 X! B4 t J5 }& j simple.LoadModel("C:\\Models\\Test.spp");
% ?! I( [ a5 J8 G" t, a; @( {( p}
2 }$ C5 T7 l k: qcatch (e) G+ n% h. a, N7 s/ P4 m9 P
{
9 v) q' q0 y3 {) v6 @% @+ \ WScript.Echo("Could not load Model!");
8 {5 N4 c" M, m3 Z& h WScript.Quit();
( ?5 s3 l) H1 Z9 C6 f( a1 Q* W& Y# C} / t* R$ Z+ n$ Y& W: m
- n& D0 l( h& g7 k: C! ]try 2 }' E" J% F/ m! I# |, G, N8 }; i1 D; R
{ 5 \+ I' m$ M; [* @0 ]
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
. z' H& ~& ] U# C4 P r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
" B- ^1 c, J& F3 f# U+ G8 } if (r == vbCancel) ( R) { l0 c- g7 C+ d/ A! G
{
) ^5 d8 C6 \* l7 E, n5 @ simple.CloseModel();
6 {9 ^2 U6 ^1 C2 J WScript.Quit(); ! `/ M$ T' ^4 b2 s: B
}
L. O: K& P# z; [- d9 P}
' n# j; j- ^9 F6 [$ Y
/ b' Y8 x. N/ S/ K% _simple.StartSimulation(".Models.Frame.EventController");
( r: E) V! ~ {7 h/ s , u5 T* Q& z2 o# L0 }3 ?6 S
if (simple.IsSimulationRunning())
' Y% w1 ]! V/ A6 l5 ?( J WScript.Echo("Simulation is running!"); 8 O$ q' S- A. U4 L# g! m! x
7 q$ `; W, E+ ~# M// Wait until simulation is finished % K, S. g; P+ h# F
while (!Finished) WScript.Sleep(2000);
: Q5 A8 @$ J4 r' Y$ y$ t, L3 y ) i- P" s7 P, J/ _& \1 _
simple.CloseModel(); , V6 u* U) w) I! Q
simple.Quit(); ) R0 ^# }+ K& R( Q
WScript.Quit();
; p- i G- ` W; C3 \/ ]! U 9 K! {- y; {$ q- E" q; n
6 t' s! P! Q3 _* _function RemoteControl_SimulationFinished() & G6 A; q9 Y% ?0 {& j4 ^
{
. _3 i* D. q5 W% @# K WScript.Echo("Simulation Finished!"); |