Jump to content

pixelsearch top-to-bottom, left-to-right


Recommended Posts

I made a scrip once wich uses pixelsearch, but I compiled it with the current version of autoit back then (wich performs pixelsearch from top-to-bottom, left-to-right instead of left-to-right, top-to-bottom). I didn't update autoit for a while, and I think the new pixelsearch function will be faster than the old one. It will take me hours if not days to convert my script. Isn't there a nice way to use the new autoit and perform pixelsearches from top-to-bottom, left-to-right?

I found a guy wich made a simple script to permform the search from bottom to top, but I assume this will be way slower than the normal pixelsearch function, even the old autoit pixelsearch will be faster I guess...

(should be edited a bit for my needs, bu that wont be the porblem).

http://www.autoitscript.com/forum/index.ph...++top-to-bottom

Isn't there something faster/easier, like a parameter or so?:)

Thanks in advance,

Jochem

Link to comment
Share on other sites

It should take the same amount of time considering it's checking the same number of pixels.

You mean the old autoit pixelsearch is as fast as the new one, or pixelsearch is as fast as pixelsearch with the script from that guy who wanted to perform searches from bottom to top?

Thanks for your fast reply.

Link to comment
Share on other sites

I don't know about the speed of the function itself, maybe I will try benchmarking it. The actual function to loop through every pixel on the screen should take the same amount of time either way.

What is the old script you are using. I will compare them.

Link to comment
Share on other sites

I don't know about the speed of the function itself, maybe I will try benchmarking it. The actual function to loop through every pixel on the screen should take the same amount of time either way.

What is the old script you are using. I will compare them.

Normal PixelSearch reversed pixelsearch:

$aPix = _PixelSearchRev(0, 0, @DesktopWidth, @DesktopHeight, 0xFFFFFF)
If Not @error Then
    MsgBox(0, "Return", $aPix[0] & ", " & $aPix[1])
EndIf

Func _PixelSearchRev ( $left, $top, $right, $bottom, $color, $shadeVar = 0, $step = 1 )
    Local $i, $j, $aRet
    For $i = $bottom To $top Step -1
        For $j = $right to $left Step -$step
            $aRet = PixelSearch( $j, $i, $j, $i, $color, $shadeVar )
            If Not @error Then
                Return $aRet
            EndIf
        Next
    Next
    SetError(1)
EndFunc

EDIT, sry I did put a sentence in the middle of the code

But I could benchmark those myself too, thanks anyway for the help! (But if ur benchmarking it, you can post the results, would be nice;))

Edited by Xanthus
Link to comment
Share on other sites

It's hard to benchmark because one script hits the first instance of that pixel before the other.

I'll just loop the script and move on to the next pixel, moving the mouse on each scanned pixel. Scan a big rectangle, and see if normal pixelsearch is faster. In theory pixelsearch is faster than the reversed one ofcourse, but I guess I won't see the difference. I'm gonna try it tonight I guess, thanks for the help, I'm saisfied;)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...