Example of a JScript ( N! [ f4 `$ E
var vbOKCancel = 1; 0 w* C( ]8 l) i/ e
var vbCancel = 2; 4 n0 s* T' x6 J
var vbInformation = 64;
+ w6 o" V& @$ c& ^* ovar Finished=false; & z+ q c# r7 `* p# s
. z' g, j& l4 V6 o4 M* ]
var WSHShell = new ActiveXObject("WScript.Shell");
# c6 K0 U: _ o% W " z. }* ?# p% T, z( Y
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
3 M) t, I9 `/ \$ w4 a7 R 3 f# t) j* p# q% d5 C m9 Z
simple.SetLicenseType("Runtime"); 9 g i( l& s0 G# h3 o u
* M* ^3 F! _/ vtry
) V: K, ?! B. e) \( h" ^4 L/ d, E0 V{ 8 M; q7 f$ _2 ~( Y1 [
// Enter the path to a model file!
% W4 z+ |9 t6 n& p$ c/ C b. u8 T: z simple.LoadModel("C:\\Models\\Test.spp"); ) S1 x, f M, ?* D" s3 u
} % K! n2 x( Q# g" I. `. @) k
catch (e)
& K7 }% O( w- [6 H' _8 [{ 2 s' j6 V4 C" @* p f' M8 B
WScript.Echo("Could not load Model!");
+ y( Q; l [* P. ^8 U% b3 R WScript.Quit(); 9 C' X( C# v- J9 I. Z( D5 T8 z
}
V! T; H4 O) f& l" @- v7 J
* O. g/ t- v1 y u9 wtry
: S; M& A$ P# s) [{ * J# t* ^; @/ o0 \! W
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { ' d8 ?/ S- S9 E5 P3 B
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ) W/ w5 y! E2 j4 C
if (r == vbCancel) 1 [) r& _! {) H) P
{ ! I% _$ B8 b, Y* a# W* q5 z1 e
simple.CloseModel();
0 V' U1 \5 z2 D. J/ { WScript.Quit();
( A$ b) j& x9 v* e. K% t } ! ~% z( h' O3 y6 x# X
} + w+ Y4 }) v: ^; d4 d
0 t9 ~! S$ d& B4 O: T; G2 g2 nsimple.StartSimulation(".Models.Frame.EventController"); $ X0 s; h' M( l9 T% N/ a
e% q! a" W. j! iif (simple.IsSimulationRunning()) ( }( [& N6 N6 Z
WScript.Echo("Simulation is running!"); 2 R. ^5 [% e4 m+ w, ~
: u: ~/ R! l6 L( o, C) E8 t1 }# o// Wait until simulation is finished
1 M& M- K6 z. R; ~( Q) Mwhile (!Finished) WScript.Sleep(2000);
4 D5 [2 k- ^5 {9 y3 W1 ]
- l% q& L; ^+ \. p* @- s, Jsimple.CloseModel();
3 h' C/ L& w3 asimple.Quit(); 3 S# F6 K7 {3 |, W
WScript.Quit();
+ {/ n; I; I K% @ , o2 J. B. |% r( L. a
1 ~* w/ f& {9 mfunction RemoteControl_SimulationFinished() 0 u+ i2 f& q9 B1 \
{
+ w# m( g- i `4 o( q/ C WScript.Echo("Simulation Finished!"); |