Jump to content

Recommended Posts

Posted

Hi. Anyeone there can explain how i make pixelsearch to a hotkey? i mean when i push lets say 6 then it searchs after a color and then push on it 2 times.. Sry my english isn't good.. But i hope someone understands me..

Posted

hi!

yeah i understand you^^

HotKeySet("6","_searchcolor")
$color = 0xff0000;this is a expample! you must edit it if you want to search at a another color!
While 1
    Sleep(100)
;;;;;;;;;
WEnd

Func _searchcolor()
    $ps = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color)
    MouseClick("left",$ps[0],$ps[1],1,0)
EndFunc

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Posted (edited)

hi!

yeah i understand you^^

HotKeySet("6","_searchcolor")
$color = 0xff0000;this is a expample! you must edit it if you want to search at a another color!
While 1
    Sleep(100)
;;;;;;;;;
WEnd

Func _searchcolor()
    $ps = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color)
    MouseClick("left",$ps[0],$ps[1],1,0)
EndFunc
Thanks! but it that made for beta?

Edit: okay now i have testet it... and it works. but when it cant find the color its jst shutdown.. can i do anything ingore it? if it cant find the color then it just dont do anything?

Edited by XInFisk
  • Moderators
Posted

You have to have the while loop, and make sure that the color was found before you click:

HotKeySet("6","_searchcolor")
$color = 0xff0000;this is a expample! you must edit it if you want to search at a another color!
While 1
    Sleep(100)
;;;;;;;;;
WEnd

Func _searchcolor()
    $ps = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color)
    If IsArray($ps) Then MouseClick("left",$ps[0],$ps[1],1,0)
EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted

You have to have the while loop, and make sure that the color was found before you click:

HotKeySet("6","_searchcolor")
$color = 0xff0000;this is a expample! you must edit it if you want to search at a another color!
While 1
    Sleep(100)
;;;;;;;;;
WEnd

Func _searchcolor()
    $ps = PixelSearch(0,0,@DesktopWidth,@DesktopHeight,$color)
    If IsArray($ps) Then MouseClick("left",$ps[0],$ps[1],1,0)
EndFunc
Oh thanks.

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
×
×
  • Create New...