Jump to content

Any way to speed up pixelgetcolor?


Recommended Posts

Hello fellow autoit peoples! :)

I'm trying to do a fairly simple script which waits for a word to pop up on the screen and when it does autoit runs a few lines and then waits for that same word to pop up again. The problem I'm running into is the word is only there for 1.5 seconds.. maybe 2 seconds, tops. Either way, using pixelgetcolor is going too slow to catch it. I'm using a 3 point system which could be whats causing it to not run quick enough. Now, the script does run, it just doesnt run fast enough.. But its the only way I can think of doing it. So for your reading enjoyment and hopefully a bit of help, here is my example.

Func Autocatcher()
$x = 1
while $x = 1 
tooltip("Script is RUNNING", 600, 990, "Pausezilla")
$whatever1 = pixelgetcolor(595, 841) ;--uses 3 points
$whatever2 = pixelgetcolor(640, 843)
$whatever3 = pixelgetcolor(671, 841)
if $whatever1 =0xFFFFFF and $whatever2 = 0xFFFFFF and $whatever3 = 0xFFFFFF Then ;--Searches for the word
send("4") ;-if found pushes 4 
$Somethingcheck= pixelgetcolor(142, 94) ;--checks to make sure it can be done using another cord
if $Somethingcheck = 0x0D0505 then ;--if it cant then push q
send("q")
sleep(50) 
EndIf
send("4") ;-continues on with the script and pushes 4 3 more times.  Needs to be quicker
sleep(50)
send("4")
sleep(50)
send("4")
sleep(4700)
#cs ^ 
long delay... this is not the problem.  I'm able to hit 4 once before the word goes away.  
I need to hit 4 at least 3 times in 1.5 seconds 
#ce
send("o") 
EndIf
WEnd
EndFunc

So is there any faster way to catch it.. does anyone see any way to speed this up or make it more efficient? This code works for things over 4 seconds. And thats just a rough estimate.. So I know the code does what its suppose to. Just not as quick as I need it too.

Link to comment
Share on other sites

ummm, what kind of screen are you trying to capture the word from? If it is a webpage, odds are you can use the IE tools to get the word. That would speed things up a bit. Also, have you tried to see if the window you are accessing will provide information to the AutoIt window info tool? If it does see the word you are looking for, then there are a few ways to get the word you need other than pixel searching.

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