Jump to content
Sign in to follow this  
tinytoon9002

A new comer need help!

Recommended Posts

Dear everyone

I am trying to make some small code to catch the pixel color inscreen. But what i got is only 0 value in my save file. It only happens when i run a graphic program then try to capture its pixels, but when i close it and run in desktop screen, it works. So can someone explain and help me to solve it.

Thanks in advance and here is my code :

3276800 = 320000H (but i don't know how to write it in Autoit)

HotKeySet("{F9}", "Terminate")

Func Terminate()

FileClose($file)

Exit 0

EndFunc

While 1

$file = Fileopen ("color.txt", 2)

$var = 0

While $var< 3276800

$var = PixelGetColor( 170 , 377)

FileWriteLine($file, String($var))

Wend

MouseClick("left", 170, 377, 1, 0)

$var = 0

While $var< 3276800

$var = PixelGetColor( 213, 352)

FileWriteLine($file, String($var))

Wend

MouseClick("left", 251, 377, 1, 0)

$var = 0

While $var< 3276800

$var = PixelGetColor(294,352)

FileWriteLine($file, String($var))

Wend

MouseClick("left", 332, 377, 1, 0)

Wend

Share this post


Link to post
Share on other sites

maybe

HotKeySet("{F9}", "Terminate")

Dim $file = FileOpen("color.txt", 2)

While 1
    $var = 0
    While $var <> "3276800"
        $var = PixelGetColor(170, 377)
        FileWriteLine($file, String($var))
        Sleep(20)
    WEnd
    MouseClick("left", 170, 377, 1, 0)
    $var = 0
    While $var <> "3276800"
        $var = PixelGetColor(213, 352)
        FileWriteLine($file, String($var))
        Sleep(20)
    WEnd
    MouseClick("left", 251, 377, 1, 0)
    $var = 0
    While $var <> "3276800"
        $var = PixelGetColor(294, 352)
        FileWriteLine($file, String($var))
        Sleep(20)
    WEnd
    MouseClick("left", 332, 377, 1, 0)
    Sleep(20)
WEnd

; ------- Functions ------------------

Func Terminate()
    FileClose($file)
    Exit 0
EndFunc  ;==>Terminate

8)

Share this post


Link to post
Share on other sites

thanks, but the problem is not in the hot key.

I mean the collected color is wrong, it always give me 0 value when i run this graphic program, so i can't catch the correct color.

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  

×
×
  • Create New...