Jump to content
Sign in to follow this  
XInFisk

Help with pixelsearch

Recommended Posts

XInFisk

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

Share this post


Link to post
Share on other sites
GtaSpider

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 Froum

Share this post


Link to post
Share on other sites
XInFisk

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

Share this post


Link to post
Share on other sites
SmOke_N

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.

Share this post


Link to post
Share on other sites
XInFisk

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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.