SRL Archive - SRL Archives

SmoothInPin


Kave

2008-05-07 07:11:01

I modified the InPin function so that the mouse doesn't leave the keypad, its more how i enter my bank pin. Only problem is that sometimes it wont actually click, it'll move to the right number then it will just wait, im guessing that the click isnt recognized by the keypad or something….

function SmoothInPin(Pin:String):Boolean;
var
num,x,y,sx,ex,sy,ey,z: Integer;
begin
if (PinScreen) then
begin
sx := 430;
sy := 30;
ex := 445;
ey := 50;
for num := 1 to Length(Pin) do
begin
z := 0;
if not(FindText(x,y,Pin[num],UpChars,1,1,512,336)) then
GetMousePos(x,y);
Mouse(x,y,0,0,true);
repeat
wait(10);
inc(z);
until FindText(x,y,'*',UpChars,sx,sy,ex,ey) or BankScreen or not(LoggedIn) or (z > 50);
if z > 50 then
begin
Result := False;
FindText(x,y,'Exit',UpChars,MSX1,MSY1,MSX2,MSY2);
Mouse(x,y,0,0,true);
exit;
end;
sx := ex;
ex := ex + 15;
Wait(100);
end;
repeat
Wait(100);
until BankScreen or not LoggedIn;
end;
Result := BankScreen;
end;

king vash

2008-05-07 10:51:29

looks great, and is great improvement, i'm always been annoyed that it leaves the keypad, one change that would also work, is have it move into the space between numbers after it clicks, this is what i do

n3ss3s

2008-05-07 10:52:43

 FindText(x,y,'*',UpChars,sx,sy,ex,ey) 

Is reliable for only the first *. You can make a function that does GetTextAtEx and counts the *s in the string, and use it like
If TheFunction >= num Then Break.

ShowerThoughts

2008-05-07 10:53:33

if you don't leave it you have to have an detection if that number not found than this keypad is this number.

Kave

2008-05-07 11:00:39

@n3ss3s
Everytime it find the '*' it moves over to just before where the next will start.
          
sx := ex;
ex := ex + 15;

@Hermpie
If it doesnt find the number, then it knows that the pad its on is the number and clicks.

if not(FindText(x,y,Pin[num],UpChars,1,1,512,336)) then
GetMousePos(x,y);