Example of a JScript
. ]! F. l( p3 _; |' bvar vbOKCancel = 1; % T0 i. V; o8 G% i
var vbCancel = 2;
& W+ _; B! s$ j. x! l yvar vbInformation = 64; , B6 p9 {+ `9 H3 @9 {" U
var Finished=false; ) W$ |6 L4 ~! E! X% ~2 m0 r2 l
& o' h7 ^- {1 [* h( {var WSHShell = new ActiveXObject("WScript.Shell");
& V4 H7 [2 C) c7 q k/ N7 a
9 i2 i( C; s8 Z k/ ]0 Zvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
$ J2 q M0 I4 K, ^3 [# m
. q- {/ B5 |: l5 D8 N" csimple.SetLicenseType("Runtime");
8 s+ P, m Y9 |( R0 ?1 n
' o, z# R; \) m: _/ itry
/ `) M4 G4 _% ?9 F, u& l( y{ ) E8 V s5 p+ i" _
// Enter the path to a model file! + a3 Q: _7 k. W7 R2 t* w
simple.LoadModel("C:\\Models\\Test.spp"); 5 F1 B$ l2 s' U
}
' n/ s( v U* {# Q! V$ P2 A5 lcatch (e) 2 c4 P1 @) O, Q% R% D' m
{
' V x$ y0 F& [# U, `" x WScript.Echo("Could not load Model!");
9 ]5 h$ F7 X) V! S/ Q+ f8 m v WScript.Quit(); / v2 @: A; w: M7 x
} * N6 v) w4 T' ]# c* Z
( [8 P2 ^, Y: g- ?2 I$ xtry # U' l3 x' [ x# @2 G
{ ' P2 M) i% x: F$ K1 P" `6 U
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , a( Z( y; z+ Y) ?8 ~
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
, k' Y+ F( h" E5 Z+ `. |& f3 H if (r == vbCancel)
, r" C: H5 D7 A8 z3 t, ?, [ {
" l+ y( G/ Y i& D0 ^& p/ { L simple.CloseModel(); , y* T& S$ V8 l
WScript.Quit(); . S8 e0 |2 R9 e' p7 T( p q
} 8 e% a, D8 K7 l, o: ~
}
0 o2 v Q* A* z( x9 Z7 ~0 S r8 R. B8 d- u0 S$ a
simple.StartSimulation(".Models.Frame.EventController");
# Q7 M i% b. B" M" ~
- Y5 u D7 r, |1 {& Z6 uif (simple.IsSimulationRunning())
0 C2 `* h. a, r9 T! W: R WScript.Echo("Simulation is running!");
! U' F7 ^' S9 j) o 2 y# l1 Y' g8 N4 ^9 ]2 [$ T
// Wait until simulation is finished
}% j8 c4 x1 y. ^while (!Finished) WScript.Sleep(2000); 6 [3 T1 }: M! P7 Q
& q+ F! Y% j( C7 d; @ c0 t
simple.CloseModel(); # _9 n) `5 R; Z% m
simple.Quit(); , R' a/ \$ i+ M# e
WScript.Quit(); % B+ j2 ]5 e" u- z: C
) U0 R) _, a/ K* e% k. v$ G
! r. _2 a" G+ u) B! Zfunction RemoteControl_SimulationFinished()
) d. n' ^# m' k0 y( N{ " ?/ P0 A1 p7 L1 o! r
WScript.Echo("Simulation Finished!"); |