Naum
2009-06-06 18:04:03
I was looking for stuff to do when..
InPin would only click on the numbers, this didn't look human like, so I did some stuff and made it find the boundaries of the box and click inside it (randomly):
InPin would only click on the numbers, this didn't look human like, so I did some stuff and made it find the boundaries of the box and click inside it (randomly):
function InPin(Pin: string): Boolean;
var
TMouseSpeed, iNumber, Tx, Ty, Counter: Integer;
TPA : Array [0..2] Of TPointArray;
ATPA : T2DPointArray;
Sq : TBox;
begin
if (CountColor(0, MSX1, MSY1, MSX2, MSY2) > 113000) and (Length(Pin) = 4) then
begin
MouseBox(26, 138, 489, 157, 1);
Counter := GetTimeRunning + 45000;
while (not BankScreen) and (GetTimeRunning < Counter) do
Wait(50);
Wait(RandomRange(100, 150));
end;
if (not(PinScreen)) then Exit;
if (GetNumbers(Pin) <> Pin) then
begin
srl_Warn('InPin', '''' + Pin + ''' is not a valid Pin', warn_AllVersions);
Exit;
end;
if (Length(Pin) <> 4) then
begin
srl_Warn('InPin', 'Pin must be 4 digits long', warn_AllVersions);
Exit;
end;
TMouseSpeed := MouseSpeed;
MouseSpeed := 25;
Wait(1000 + Random(1000));
repeat
if (PinScreen) then
begin
for iNumber := 1 to Length(Pin) do
begin
if (Random(4) = 0) then
begin
repeat
Tx := Random(765);
Ty := Random(504);
until (not(IntInBox(Tx, Ty, IntToBox(30, 100, 383, 319))));
MMouse(Tx, Ty, 0, 0);
Wait(500 + Random(500));
end;
if (not(FindText(Tx, Ty, Pin[iNumber], UpChars, 30, 100, 383, 319))) then
GetMousePos(Tx, Ty);
if (FindText(Tx, Ty, Pin[iNumber], UpChars, 30, 100, 383, 319)) then
Begin
FindColorsTolerance(TPA[0], 8356779, 30, 100, 383, 319, 0);
FindColorsTolerance(TPA[1], 1341, 30, 100, 383, 319, 0)
TPA[2] := CombineTPA(TPA[0], TPA[1]);
ATPA := TPAToATPAEx(TPA[2], 65, 65);
SortATPAFromFirstPoint(ATPA, Point(Tx, Ty));
Sq := GetTPABounds(ATPA[0]);
Mouse(RandomRange(Sq.x1, Sq.x2), RandomRange(Sq.y1, Sq.y2), 0, 0, True);
Wait(1000 + Random(500));
End;
end;
end;
Wait(1000 + Random(500));
if (BankScreen) then
begin
Result := True;
MouseSpeed := TMouseSpeed;
Exit;
end;
ClickContinue(True, True);
while (not(FindColor(Tx, Ty, 0, 7, 460, 69, 474))) do
begin
if (not(LoggedIn)) then
begin
MouseSpeed := TMouseSpeed;
Exit;
end;
Wait(1000 + Random(500));
end;
Inc(Counter);
until(Counter > 2);
end;