Jump to content

PixelSearchin


gainstaa
 Share

Recommended Posts

Well thisi what I have so far

$Command = 0
    Hotkeyset ( "O", "exit1")
while 1 = 1
PixelSearch ( 60, 60, 1220, 500, < 0x151515 then Command()
wend

func Command()
    mouseclick ("left")
    sleep(100)
endfunc
    


    func exit1()
        Exit (0)
        endfunc

What I want it to do is search the screen for anything darker than ( 0x151515 ) Then move mouse to the pixel and click when I press H ( dont know how to do this)

and theres an error on the pixel search line dont know what it is though

Press O to close

Edited by gainstaa
Link to comment
Share on other sites

HotKeySet("0", "Exit")
HotKeySet("H", "Search")

While(1)
WinActive("NAME OF WINDOW SEARCHED ON")
WEnd

Func Search()

$coord = PixelSearch( 60, 60, 1220, 500, < 0x151515)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)

EndFunc

Func Exit()
End
EndFunc

More something like that, not so sure of the <0x151515 though.

Edited by Arakard
Link to comment
Share on other sites

HotKeySet("0", "Exit")
HotKeySet("H", "Search")

While(1)
WinActive("NAME OF WINDOW SEARCHED ON")
WEnd

Func Search()

$coord = PixelSearch( 60, 60, 1220, 500, < 0x151515)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)

EndFunc

Func Exit()
End
EndFunc

More something like that, not so sure of the <0x151515 though.

I just tested this again and for some reason nothing works the hotkeys do nothing.
Link to comment
Share on other sites

HotKeySet( "p", "exit1")
HotKeySet( "h", "Search")

While(1)
WinActive("untitled - Paint")
WEnd
Func Search()

$coord = PixelSearch( 300, 60, 980, 500, 0x000000)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)
endif
EndFunc

Func exit1()
    Exit (0)
EndFunc

ok now that whole thing works now I just want to change the colour to > 0x151515 because the below doesnt work

HotKeySet( "p", "exit1")
HotKeySet( "h", "Search")

While(1)
WinActive("untitled - Paint")
WEnd
Func Search()

$coord = PixelSearch( 300, 60, 980, 500, > 0x151515)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)
endif
EndFunc

Func exit1()
    Exit (0)
EndFunc
Edited by gainstaa
Link to comment
Share on other sites

ok now that whole thing works now I just want to change the colour to > 0x151515 because the below doesnt work

Func Search()
$coord = PixelSearch( 300, 60, 980, 500, > 0x151515)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)
endif
EndFunc
What is it you expect the ">" operator to do in that context? :)

That's just plain invalid syntax. The color field is a 24bit RGB unsigned integer. No comparison operator is valid there.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

OK i finally figured it out. Now what I want is for it to do this when I click instead of press H I've tried mouse down but it dont work.

Before I just wanted it to find anything darker than 0x111111 and now it does.

HotKeySet( "p", "exit1")
HotKeySet( "h", "Search")

While(1)
WinActive("untitled - Paint")
WEnd
Func Search()

$color = 0x111111
$coord = PixelSearch( 590, 350, 690, 450, $color ,5)
If not @error then
MouseClick("left", $coord[0], $coord[1], 2, 0)
endif
EndFunc

Func exit1()
    Exit (0)
EndFunc
Edited by gainstaa
Link to comment
Share on other sites

OK i finally figured it out. Now what I want is for it to do this when I click instead of press H I've tried mouse down but it dont work.

Before I just wanted it to find anything darker than 0x111111 and now it does.

$color = 0x111111
$coord = PixelSearch( 590, 350, 690, 450, $color ,5)
My understanding is that this is not actually looking for anything "Darker" than $color, But is infact looking for any pixel within 5 Shades of $color. This includes Lighter or darker.

#Include <Misc.au3>
HotKeySet( "p", "exit1")
;HotKeySet( "h", "Search")

While(1)
    If _IsPressed("01") Then Search()
    WinActive("untitled - Paint")
WEnd

Func Search()
    $color = 0x111111
    $coord = PixelSearch( 590, 350, 690, 450, $color ,5)
    If not @error then
        MouseClick("left", $coord[0], $coord[1], 2, 0)
    endif
EndFunc

Func exit1()
    Exit (0)
EndFunc
Edited by ofLight

There is always a butthead in the crowd, no matter how hard one tries to keep them out.......Volly

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...