procedure
TForm1
.
Button6Click(Sender: TObject);
var
i,k,z :
integer
;
motorX :
string
;
motorY :
string
;
memstr :
string
;
begin
if
form1
.
OpenDialog1
.
Execute
then
Memo3
.
Lines
.
LoadFromFile(OpenDialog1
.
FileName);
i:=Memo3
.
Lines
.
Count;
while
i >=
0
do
begin
if
(copy(Memo3
.
Lines
.
Strings[i],
1
,
1
) <>
'X'
)
then
Memo3
.
Lines
.
Delete(i);
i:=i-
1
;
end
;
k:=
0
;
while
(k <= Memo3
.
Lines
.
Count-
1
)
do
begin
memstr := Memo3
.
Lines
.
Strings[k];
i:=
2
;
while
memstr[i]<>
'Y'
do
begin
if
memstr[i]<>
'.'
then
motorX := motorX+memstr[i];
inc(i);
end
;
inc(i);
while
i<= length(memstr)
do
begin
if
memstr[i]<>
'.'
then
motorY := motorY+memstr[i];
inc(i);
end
;
motorY :=
'ATS=Y'
+motorY;
WriteComm(motorY);
sleep(
100
);
motorX :=
'ATS=X'
+motorX;
WriteComm(motorX);
sleep(
100
);
if
((ststX=
'OK'
)
and
(ststY=
'OK'
))
then
begin
Form1
.
Caption:= IntToStr(k)+
' OK'
;
sleep(
1000
);
inc(k);
end
else
begin
Form1
.
Caption:= IntToStr(k)+
' No'
;
sleep(
1000
);
inc(k);
end
;
end
;
end
;
procedure
TForm1
.
Memo1Change(Sender: TObject);
var
j :
integer
;
begin
Memo2
.
Lines
.
Text := Memo1
.
Lines
.
Text;
for
j:=
0
to
Memo2
.
Lines
.
Count-
1
do
begin
if
pos(
'ATSXOK'
,Memo2
.
Lines
.
Strings[j])>
0
then
ststX:=
'OK'
else
ststX:=
'NO'
;
if
pos(
'ATSYOK'
,Memo2
.
Lines
.
Strings[j])>
0
then
ststY:=
'OK'
else
ststY:=
'NO'
;
end
;
inc(nn);
Form1
.
Caption:= Form1
.
Caption +
' '
+ IntToStr(nn);
end
;