Example of a JScript
: I6 }% C% R* o; N* ~: c# Y# jvar vbOKCancel = 1; . ?! H# C3 B% {3 S
var vbCancel = 2;
8 q8 W+ Q9 a% D+ @) B' nvar vbInformation = 64; # K1 `2 Z6 Z% q: l; L" U
var Finished=false;
7 A( O. W8 R# \, |; ?9 D; e
V( D# {) p) g6 i. U+ @8 ], O, C8 N: } Dvar WSHShell = new ActiveXObject("WScript.Shell");
( Q& d9 o1 o: y$ t
. v5 [2 m; N5 l7 vvar simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_"); * |$ ?/ K4 I* o) C% c0 U* W, Q
4 c4 N6 T% g q: X2 h/ Z" Y
simple.SetLicenseType("Runtime");
$ W1 Y4 t7 t7 T- X0 v) D: P , |, {+ T3 R, v, l2 A$ z0 a
try # e# j: M* _4 v* b) w' G8 m
{ ; {7 H0 ]1 a( s% V) x3 d" w
// Enter the path to a model file!
. v' v( `7 H: o% K$ O' r) w% d( s8 S simple.LoadModel("C:\\Models\\Test.spp");
. g' U. ~! F2 M+ k# g} - K! Q1 e+ k( l' Q# y
catch (e)
I6 C; q7 n- u$ y6 D{
: @/ }' O6 e( q6 b O' L WScript.Echo("Could not load Model!");
; g0 D8 }- Z6 s% A WScript.Quit(); # m1 b+ w0 H X$ O9 Q) `5 D
}
$ d! e, O$ y+ ~8 n- s
' G3 x z0 Z, P) v1 X- K# ctry $ S0 k& b/ R) s+ M/ B( M6 D
{
: b) [' M0 g% V& B" | simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { 4 G7 |% Q# J) ]) p% x2 n3 E. }; z
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation); : B4 r% Z9 E5 p% r9 Z4 C
if (r == vbCancel) & |5 X* c. r/ a1 U4 e
{
$ B; E- K9 x. u `1 d5 b simple.CloseModel(); # x8 |7 F5 @. [2 J4 J9 W; z
WScript.Quit();
& ^& ^4 d' h/ o8 Z: S+ r }
$ g) e# y3 ^, V1 i& @8 R$ u5 |, X}
, x0 l' Z3 u# l$ G! K3 m
" a; |3 ]8 S& L3 j( Y- zsimple.StartSimulation(".Models.Frame.EventController"); 1 M9 }$ m2 h L9 {
/ g- S( r; M, K- T; E. t$ Uif (simple.IsSimulationRunning()) - `2 r. `2 |' ?: M2 w* X
WScript.Echo("Simulation is running!"); 7 ^1 r( {/ L$ _& P0 t6 t9 D/ V
7 F: k* N6 D/ D2 s, W4 [/ ~7 ^// Wait until simulation is finished
5 j0 Z8 g; D; ^5 Z0 e6 J7 [, Jwhile (!Finished) WScript.Sleep(2000); g! E0 f& W8 K4 ?) r3 P Y: B
4 W* J) b2 J3 T8 m
simple.CloseModel(); 3 T3 R; x7 Q+ x- |0 S
simple.Quit();
1 C. n2 w/ X; z% YWScript.Quit(); , E7 g. T2 d- R8 L. g0 ^8 T; O
2 o" \! [+ w1 o& Z
! L' c* ?# `7 jfunction RemoteControl_SimulationFinished() % \4 C* g- L' H( E1 G/ K
{ / g. X: f& {# w' M1 k3 G4 F
WScript.Echo("Simulation Finished!"); |