SRL Archive - SRL Archives

ChooseOptionMulti


Naike

2008-09-04 16:46:27

{*******************************************************************************
function ChooseOptionMulti(Text: TStringArray): Boolean;
By: Wizzup? modified by N1ke!
Description: Finds Popup menu, then clicks on it.
Will look for the first string first and so on.
*******************************************************************************}
function ChooseOptionMulti(Text: TStringArray): Boolean;
var
B: TBox;
TPA: TPointArray;
X, Y, I, C: Integer;
P: TPoint;

begin
Result := False;
GetClientDimensions(B.X2, B.Y2);
B.X1 := 0;
B.Y1 := 0;
FindColorsTolerance(TPA, 4674653, B.X1, B.Y1, B.X2, B.Y2, 0);
If Length(TPA) < 10 Then
Exit;
B.X2 := 0;
B.Y2 := 0;

P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[I].X = TPA[I+1].X - 1 Then
Begin
If C > 5 Then
Begin
B.X1 := P.X;
B.Y1 := P.Y;
Break;
End Else
C := C + 1;
End
Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
InvertTPA(TPA);
C := 0;
P := TPA[0];
For I := 0 To High(TPA) - 1 Do
If TPA[I].X = TPA[I+1].X + 1 Then
Begin
If C > 5 Then
Begin
B.X2 := P.X;
B.Y2 := P.Y;
Break;
End Else
C := C + 1;
End Else
Begin
P := TPA[I + 1];
C := 0;
End;
If I = Length(TPA) Then
Begin
WriteLn('Choose Option Menu Getting Failed');
Exit;
End;
For i:=0 To High(Text) do
begin

If FindText(X, Y, Text[i], upchars, B.X1, B.Y1, B.X2, B.Y2) Then
Begin
Result := True;
Mouse(B.X1 + 5, y + 1, B.X2 - B.X1 - 5, 13, True);
Exit;
End;
end;

MMouse(B.X1 - 50, B.Y1 - 50, 40, B.Y2 - B.Y1);
Wait(200 + Random(100));
end;

Looks for more then one line in the ChooseOption popup menu.

Wizzup?

2008-09-27 15:11:40

Heh, I see some bad indenting. ;)
Anyway, this might be a use full addition.

TViYH

2008-09-27 18:30:12

So, this uses an array like IsUpTextMultiCustom?

Nava2

2008-09-28 01:18:46

Yeah, I have found lots of uses for it! :)

NiCbaZ

2008-09-28 05:51:30

Good job N1ke Very UsefulL :)

ZephyrsFury

2008-10-06 02:58:09

Added to the Dev SVN.