Example of a JScript
4 j( W" Q: X, Z" M; N9 V* avar vbOKCancel = 1;
% `* w( @- p) d( y i# ^* mvar vbCancel = 2;
m/ R" c* q4 j) Nvar vbInformation = 64; , R" c9 a5 G# D8 P# W5 A. v
var Finished=false;
/ o* D( V; h1 Z/ ^4 ~$ K " q! H" E. M: `+ u' E
var WSHShell = new ActiveXObject("WScript.Shell");
4 E" b/ g' F7 P - o9 g! [4 f0 j* x
var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); & m+ _" D/ k4 w0 K; u$ l8 {4 D% b
& V' X! C. |( y1 Usimple.SetLicenseType("Runtime");
/ y) Q$ e- p' ?, ]1 _" |8 \
/ J/ S* D2 a: N6 ctry
- E8 ]6 x1 p: E- Y6 A; b{
/ j, t8 i1 k& I. t* Y // Enter the path to a model file! / B6 k B3 t8 A' x
simple.LoadModel("C:\\Models\\Test.spp"); 3 ]: k/ H4 Y2 |. L' G8 e
}
% n4 K N9 j& @9 v) t, P5 Ecatch (e)
+ E- P7 Q8 z) m6 Q7 s{ 8 y, c$ `9 Z+ o% e
WScript.Echo("Could not load Model!");
+ |* ^4 C6 E, T, l WScript.Quit();
* N" V7 {5 s5 p1 g6 k} , _4 K3 G* \: F
* W( x, I0 M; Q& |: r& b: otry
/ R: P2 A, R, w, o{ 7 U+ ]: B0 M0 T: X7 C( }
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 3 M- M( J) a! V! T. v
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
* B+ n% h" K1 w. v d if (r == vbCancel) 9 L3 z& a+ }4 m* g/ A( H8 M
{
) H0 y. w1 A* E) y+ H simple.CloseModel();
0 P) n" G9 F; [* J# l/ I/ p WScript.Quit(); & s7 A/ Z" _6 Z8 w" M" d4 |3 d
} & c( a1 F5 f6 i
} # W$ e5 Q+ p3 p0 I
3 j8 F) |- @0 [8 b) t8 L2 `simple.StartSimulation(".Models.Frame.EventController");
/ }- P! ^7 j! b9 D6 a! L , S5 W' X& P% v6 n- a
if (simple.IsSimulationRunning()) 9 s) i5 }; V2 O' E" Q
WScript.Echo("Simulation is running!"); % D* Z% G; v( m" Q/ I0 d) V
% u3 j& `& v" V+ U6 R0 a9 I0 N5 u& b
// Wait until simulation is finished
3 g/ m( p g4 m! B$ e, Owhile (!Finished) WScript.Sleep(2000);
0 E: G" H- S, L# y* j/ e2 m( P : C. E2 D; x8 S1 z
simple.CloseModel(); - _- k1 u+ J; F, U. q, B- V8 S( V2 x
simple.Quit(); ) S2 ]! _- ]8 q K4 p
WScript.Quit();
, [/ [8 N% A) L7 c; }! \ & K, M9 l8 h1 h3 |+ G, a' [4 |0 {
: V2 ]: B t, [1 M- l; ^) t# z
function RemoteControl_SimulationFinished()
' [8 ]7 R0 W) J6 ?! A{
g- N! O/ R4 E WScript.Echo("Simulation Finished!"); |