Jump to content

PixelGetColor and _ScreenCapture_Capture problem


jueki
 Share

Recommended Posts

hi, first of all sorry for my bad english as i am not from the US.

i have a question about PixelGetColor & _ScreenCapture_Capture functions.

i used the ScreenCapture.au3 function _ScreenCapture_Capture to take a screenshot of a region from the active window(1024x768) but it always takes the screenshot of the set region from my monitor resolution :D

same problem with the PixelGetColor function, its not checking the pixel colour of the active window, instead its comparing the pixel from my monitors resolution.

these are my two codes:

$coord1 = PixelGetColor(320, 836)
If Hex($coord1, 6) = "FF671D" Then MsgBox(0,"test",$coord1)

and

_ScreenCapture_Capture("captcha.jpg", 532, 580, 735, 647)

i hope someone can help me, thanks in advance!

Edited by jueki
Link to comment
Share on other sites

i have tried with all 3 of em, none of them worked :D

opt("PixelCoordMode",2)
$coord1 = PixelGetColor(320, 836)
If Hex($coord1, 6) = "FF671D" Then MsgBox(0,"test",$coord1)

currently. this one just activated after i switch to the said active window, but still scans the whole screen.

thanks for your reply!

Edited by jueki
Link to comment
Share on other sites

i have tried with all 3 of em, none of them worked :P

opt("PixelCoordMode",2)
$coord1 = PixelGetColor(320, 836)
If Hex($coord1, 6) = "FF671D" Then MsgBox(0,"test",$coord1)

currently. this one just activated after i switch to the said active window, but still scans the whole screen.

thanks for your reply!

PixelGetColor() doesn't 'scan' anything, it only reads a single pixel. What function exactly "scans the whole screen"?

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

If not WinActive("$app") then WinActive("$app")
WinWaitActive("$app")
opt("PixelCoordMode",2)
$coord1 = PixelGetColor(320, 836)
If Hex($coord1, 6) = "FF671D" Then MsgBox(0,"test",$coord1)

this is the code snipped i use atm. my desktop resolution is 1400x1050, the resolution of the game is just 1024x768. i want it to scan the bottom left corner of the game and check 1 pixel, then if the pixel matches the value in hex (here i ts FF671D) then it sends a key, if not it goes back to another function.

what it does instead is, scan the coord i set (320,836) from my desktop resolution. i want it to only scan within the game.

hope thats what you meant

Edited by jueki
Link to comment
Share on other sites

If not WinActive("$app") then WinActive("$app")
WinWaitActive("$app")
opt("PixelCoordMode",2)
$coord1 = PixelGetColor(320, 836)
If Hex($coord1, 6) = "FF671D" Then MsgBox(0,"test",$coord1)

this is the code snipped i use atm. my desktop resolution is 1400x1050, the resolution of the game is just 1024x768. i want it to scan the bottom left corner of the game and check 1 pixel, then if the pixel matches the value in hex (here i ts FF671D) then it sends a key, if not it goes back to another function.

what it does instead is, scan the coord i set (320,836) from my desktop resolution. i want it to only scan within the game.

hope thats what you meant

Couple of things:

1. Take the quotes off your variable reference to $app.

2. WinActivate(), not WinActive() at the end of the first line.

3. It is still not scanning anything, just checking a single pixel.

4. $coord1 implies a coordinate by its name, but it's only the color.

Opt("WinTitleMatchMode", 2)
$app = "Mozilla Firefox"
If Not WinActive($app) Then WinActivate($app)
WinWaitActive($app)
Opt("PixelCoordMode", 2)
$coord1 = PixelGetColor(320, 836)
ConsoleWrite("Debug: $coord1 = " & $coord1 & @LF)
$HexCoord1 = Hex($coord1, 6)
ConsoleWrite("Debug: $HexCoord1 = " & $HexCoord1 & @LF)

5. Are you trying to SEARCH for a pixel? If so, look up PixelSearch() in the help file.

:D

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

scanning or checking.. i did not differ it.

its checking, reading, whatever it means to "display" or "output" the colour in decimals (as described in the F1 help file) from the pixel coord 320,836, and i simply just want it to read/check/whatever from inside the program itself, so it wouldnt matter where i move the game-screen on my monitor

thanks for the the other hints tho, not so sure why i added the "'s after and before the $app :D.

edit: to explain it again as simple as i can:

i want it to check/read the pixel 320,836 using only the game window resolution(which is 1024,768). it means it doesnt matter where i move the window on my screen, it would still just get the coord of this pixel inside the game. the value returned is in decimals (in this case, 16738077 - which is FF671D in hex).

right now, its giving me the colour of a desktop icon thats placed around that coord on my desktop, but not the game window. if it 'checks' this pixel at 320,836 and the value is the same as i want it to be (16738077 or FF671D) then it should proceed to the next function.

thats all i want, i cant explain it any better, sorry

Edited by jueki
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...