Example of a JScript
* }: A; d9 h6 k5 j2 W1 h3 m* Avar vbOKCancel = 1; ( ^# J( ^0 e5 L3 p- t5 b* \
var vbCancel = 2;
2 k$ q$ J( \: G) P7 {; e+ F2 avar vbInformation = 64;
6 q; x$ w; _6 p: xvar Finished=false;
; C( ^6 U) `% I* R! J* c, Y2 Z; o- _ ( F3 d# K' l) |, ^
var WSHShell = new ActiveXObject("WScript.Shell");
3 f9 P' B" M: ^ L3 }4 p6 n
( c( L4 F0 N1 }: ]. A( gvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
' I! F; o( t- A% s/ P . R; V, h" I" T) f" H7 j
simple.SetLicenseType("Runtime");
( l( {2 j6 e1 s1 Z
. r" @1 y, S5 R2 o" e, ^* d3 rtry
# b% g& u/ D4 {& S{ ) p; {( b" O# n7 l4 w: R: }6 ?
// Enter the path to a model file!
3 f S$ M# K' W& h7 R6 a simple.LoadModel("C:\\Models\\Test.spp");
2 b; ~6 x c7 l! ?}
3 c u+ E& @7 A, @8 C7 O* g, Gcatch (e)
2 h$ J& B2 ~( l( }0 J{
G! s9 V& o9 y+ ^: e K WScript.Echo("Could not load Model!");
, t( |- s2 c; f+ e, k WScript.Quit(); : c+ B: U3 p5 |4 P
} . q* C! N2 ]& I* I% v" J9 {
- I$ l7 l+ O* G+ @% k+ E
try 8 m4 m' V0 n* Y( N9 U( q
{
! Y `3 N% V+ ] simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) {
7 ^1 n5 X# q5 ?& r r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); ! r- e( W2 ]. s, {0 q4 v
if (r == vbCancel) ) Q1 a" l& q' r) A6 G
{
0 V/ B/ f G. |% A/ w7 k simple.CloseModel();
* V% L( ]5 Q' P. p& d# t0 x WScript.Quit(); , }. K$ l9 y% E: y7 n7 G
} 0 F4 m! d2 z1 @7 c' j* L' }
} 4 J5 C5 h# X' C2 ?8 Q+ r/ n
" ~4 S8 L: V+ |% T+ @" U
simple.StartSimulation(".Models.Frame.EventController");
8 B$ T4 b; H& y- d 4 j8 s% m5 g6 m5 v6 e( S. E- g
if (simple.IsSimulationRunning())
# m3 S( p* g: X& e WScript.Echo("Simulation is running!"); 9 y0 t& r1 [: }% Z7 v+ ]
9 _8 s6 B8 q6 T+ Y
// Wait until simulation is finished
) p M3 a+ Z6 O+ A" Ewhile (!Finished) WScript.Sleep(2000); 3 ~# {" g% z- j4 z
+ ^+ M- @" j5 O- w% Asimple.CloseModel(); - R5 h$ j9 v0 E; Y8 @
simple.Quit();
$ Q; o5 y3 ~2 z5 m" Z( YWScript.Quit();
6 n' e9 q% R" Y8 t
0 n% E4 v) c$ Q" n ) w; T# Y* u0 G# U, V/ C
function RemoteControl_SimulationFinished()
# T- W3 ^! Y1 c. D& t* E6 y{
0 X: E0 R) y D. N0 X' O WScript.Echo("Simulation Finished!"); |