Example of a JScript
" Q# B @, l' H- Ivar vbOKCancel = 1;
5 {+ d1 H6 w& l5 Y# V( p) nvar vbCancel = 2; ! V0 ^/ l7 _2 ]4 j* h O
var vbInformation = 64;
' }1 V h. ?# d9 Y0 D1 @" Nvar Finished=false;
3 @, e) g1 K6 m- U; ^3 m ) ^! f, w' p) d
var WSHShell = new ActiveXObject("WScript.Shell"); 8 _' B3 l0 n/ H O
) h8 @9 F& W+ B- {var simple = WScript.CreateObject("Tecnomatix.PlantSimulation.RemoteControl.9", "RemoteControl_");
9 {1 C. C3 i/ V/ F- v } 5 Z# e6 x/ o v; |: G
simple.SetLicenseType("Runtime");
$ g' E; p' ^8 i8 ?+ R) i5 b
7 F% K- c7 }" Ptry 5 d: c2 j0 u8 v. K8 R, O# s
{
0 b T% y/ I/ i! l' K% Z; x // Enter the path to a model file! : L4 z w/ u3 p3 y
simple.LoadModel("C:\\Models\\Test.spp");
1 Z2 u6 u R/ I} |% B ~: N1 t! |7 Q% q/ f
catch (e)
- Q3 u; }: }! P! N) ?: _! y6 c{
; A( @4 |7 I; b: p6 U7 C- S( N WScript.Echo("Could not load Model!");
8 X% f2 v" ` `1 G2 R" E! P, q. h WScript.Quit();
1 U. G) N. L; e1 u9 |; Z} 6 X! I# f& Q% P- D% q
$ `& { D D: o% b
try
, e7 H2 |4 y L" c w{ 3 | ~* s" }8 e- `
simple.SetValue(".Models.Frame.Buffer.procTime", 700.0); } catch (e) { , w1 ^( `' J3 q, z/ Z; M; x
r=WSHShell.Popup(e.description, 0, "Continue?", vbOKCancel + vbInformation);
y' S- g9 S& R if (r == vbCancel) * Z; f: ?9 R& ]0 g# `
{
! C& C/ t, M; ]: [# ^& M9 H simple.CloseModel(); 1 p7 U0 D% T& c& n
WScript.Quit();
0 j$ l! h7 g3 r+ S- K }
1 p6 h' j, i" H: `, \}
2 l. R4 V- g, W
8 A& W8 m9 P* I* j5 p5 v3 m/ v8 zsimple.StartSimulation(".Models.Frame.EventController");
8 Z' A& ^) H# K5 z2 N
% M/ ] h: u0 j: b1 u( kif (simple.IsSimulationRunning())
7 i) Z, O2 q5 o* ~$ m, N/ h9 r; E WScript.Echo("Simulation is running!");
) o- o& s% F5 h' S' K+ G) p2 f % Z% g& | G2 t/ p$ P
// Wait until simulation is finished
3 f# O4 q* d0 J- M2 z z9 I3 owhile (!Finished) WScript.Sleep(2000);
* j6 s- P( X) z- X( l, G ' A% t ` z: B3 q
simple.CloseModel(); ! }# A- ]3 R7 G+ Z7 d+ I
simple.Quit();
0 Y1 R) v+ l9 Y) e5 iWScript.Quit(); 1 d$ K, v( t9 s% L& E( c* h# R6 m
/ L6 H) C4 E6 O9 M; y6 Z
: a. [9 K' s# _" [$ [' M# Ffunction RemoteControl_SimulationFinished() % t* v/ W' ~+ l3 w* K3 B9 I j5 n& ^
{
h! L1 \; w$ [. Z- l6 A WScript.Echo("Simulation Finished!"); |