Sign in to follow this  
Followers 0
XInFisk

Help with pixelsearch

6 posts in this topic

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



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

#3 ·  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

Share this post


Link to post
Share on other sites

Dosnt anyone know that?

Share this post


Link to post
Share on other sites

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


[center]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.[/center]

Share this post


Link to post
Share on other sites

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  
Followers 0