Sign in to follow this  
Followers 0
ghostofdeath

PixelGetColor

7 posts in this topic

Here's my code, i think the $handle isnt working propely with pixelgetcolor variables

HotKeySet("{DELETE}","start")
HotKeySet("{INSERT}","pause")
HotKeySet("{END}","end")
$handle=WinGetHandle ("LinkCrews.com - Surf - Mozilla Firefox")
Global $Paused
Func end()
    Exit 0
EndFunc

Func pause()
$Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Func start()
    $dec=Dec("2F2C2C")
    $dec2=Dec("666666")
    Do
        $pixel=PixelGetColor(37,702,$handle)
        $pixel2=PixelGetColor(93,740,$handle)
        $pixel3=PixelGetColor(25,735,$handle)
        If $pixel=$dec Then
            ControlClick("LinkCrews.com - Surf - Mozilla Firefox", "", "[CLASS:MozillaWindowClass; INSTANCE:5]","left","2",444,47)
            sleep(3000)
            ControlSend("LinkCrews.com - Surf - Mozilla Firefox","","","{ESC}")
        EndIf
        sleep(2000)
        if $pixel2=$dec2 Then
            ControlSend("LinkCrews.com - Surf - Mozilla Firefox","","","{f5}")
        EndIf
    Until $Paused
EndFunc
while 1
    sleep(100)
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

You can't test for pixels on a non-visible window. If you use winActivate you can bring the test window into focus, and then your script should work.

Edited by Jrowe

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This is kind of theory here but... I think you can pull the device context from a hidden(being minimized or whatever) window, and then get a pixel color from it that way. I know this would work on Windows Vista because Vista doesn't needlessly repaint windows. :P

Edited by cppman

Share this post


Link to post
Share on other sites

so why exactly would have the handle feature on pixelgetcolor? if its shown in window, you dont need a winhandle proprerty

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

so why exactly would have the handle feature on pixelgetcolor? if its shown in window, you dont need a winhandle proprerty

Ah, right. I was using an older-version that didn't have that parameter. I'm not sure what Windows does internally with the device context of a window when it is minimized, so I'm not sure. As far as I know, it'd work on Vista because the information in the device context (or surface, rather), won't change if the window is dragged off the screen, or minimized.

Otherwise, I'm not sure.

Edited by cppman

Share this post


Link to post
Share on other sites

So.. anyone has any idea?

Share this post


Link to post
Share on other sites

I have the same problem.. It's harder what you think. Now i can't find this topic but i know it's impossible to do in AutoIt but possible for C++.

I don't know C++, but read this: http://www.fengyuan.com/article/wmprint.html If you are good in c++ you can write small code, create dll library and then use this in autoit (by DllCall function). If you will do it conctact with me. I also need this.


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