Sign in to follow this  
Followers 0
akroon

PixelGetColor problem

55 posts in this topic

#1 ·  Posted (edited)

Hi all i have a problem with function pixelgetcolor. This is the code.

#include <GUIConstantsEx.au3>#include <ColorConstants.au3>#include <WindowsConstants.au3>#include <GUIConstants.au3>#include <GuiEdit.au3>#include <File.au3>#include <INet.au3>#include <Color.au3>AutoItSetOption("MouseCoordMode", 2)GUICreate("My program",305,305)$pcheckinput=GUICtrlCreateInput("0 0 0000000",80,210,120,20)$colortaked=GUICtrlCreateGraphic(205,210,20,20)$handle = WinGetHandle("My program")If @error Then    MsgBox(4096, "Error", "Could not find program") ExitElse    MsgBox(0,"Success","program find successfully")EndIfGUISetState(@SW_SHOW)MsgBox(0,"Point checker","move mouse at the point and wait, the window will close in 5 seconds",5)$xy=MouseGetPos()GUICtrlSetData($pcheckinput,$xy[0]&" "&$xy[1]&" ")$xy=PixelGetColor($xy[0],$xy[1],$handle)GUICtrlSetData($pcheckinput,$xy,1)GUICtrlSetBkColor($colortaked,$xy)
The problem is that: the function pixelgetcolor don't return the pixelcolor of the window of "My program". This program is another program (not the program i'm running for check pixelcolor). How can solve this problem?

Thanx.

Edited by akroon

Share this post


Link to post
Share on other sites



I tested your code and from what I understood, it worked just fine!

#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiEdit.au3>
#include <File.au3>
#include <INet.au3>
#include <Color.au3>
AutoItSetOption("MouseCoordMode", 2)
GUICreate("My program",305,305)
$pcheckinput=GUICtrlCreateInput("0 0 0000000",80,210,120,20)
$colortaked=GUICtrlCreateGraphic(205,210,20,20)
$handle = WinGetHandle("My program")
If @error Then    
   MsgBox(4096, "Error", "Could not find program")
   Exit
Else    
   MsgBox(0,"Success","program find successfully")
   EndIf
   GUISetState(@SW_SHOW)
   MsgBox(0,"Point checker","move mouse at the point and wait, the window will close in 5 seconds",5)
   $xy=MouseGetPos()
   GUICtrlSetData($pcheckinput,$xy[0]&" "&$xy[1]&" ")
   $xy=PixelGetColor($xy[0],$xy[1],$handle)
   GUICtrlSetData($pcheckinput,$xy,1)
   GUICtrlSetBkColor($colortaked,$xy)
   MsgBox(1,"",$handle)

 

Share this post


Link to post
Share on other sites

Are you running the "Program" in a web browser?

 

No the "program" is .exe

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

 

I tested your code and from what I understood, it worked just fine!

#include <GUIConstantsEx.au3>
#include <ColorConstants.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GuiEdit.au3>
#include <File.au3>
#include <INet.au3>
#include <Color.au3>
AutoItSetOption("MouseCoordMode", 2)
GUICreate("My program",305,305)
$pcheckinput=GUICtrlCreateInput("0 0 0000000",80,210,120,20)
$colortaked=GUICtrlCreateGraphic(205,210,20,20)
$handle = WinGetHandle("My program")
If @error Then    
   MsgBox(4096, "Error", "Could not find program")
   Exit
Else    
   MsgBox(0,"Success","program find successfully")
   EndIf
   GUISetState(@SW_SHOW)
   MsgBox(0,"Point checker","move mouse at the point and wait, the window will close in 5 seconds",5)
   $xy=MouseGetPos()
   GUICtrlSetData($pcheckinput,$xy[0]&" "&$xy[1]&" ")
   $xy=PixelGetColor($xy[0],$xy[1],$handle)
   GUICtrlSetData($pcheckinput,$xy,1)
   GUICtrlSetBkColor($colortaked,$xy)
   MsgBox(1,"",$handle)

 

Are you sure the color it get is correct? I get wrong color. You will see the color getted in guigraphich.

Edited by akroon

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

In order to get help, you need to clearly define the problem. More specificly this part:

"The problem is that: the function pixelgetcolor don't return the pixelcolor of the window of "My program". This program is another program (not the program i'm running for check pixelcolor). How can solve this problem?
Thanx."

You also need to describe what the problem really is: what result did you get - and what did you expect to get?

Edited by Xibalba

Share this post


Link to post
Share on other sites

From the function pixelgetcolor i get the color of desktop and not of the program.

Sorry for my english

Share this post


Link to post
Share on other sites

Are you by chance trying to pull the color from a 3D app?


MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Share this post


Link to post
Share on other sites

Are you sure the color it get is correct? I get wrong color. You will see the color getted in guigraphich.

 

n4Wod.jpg

 

That's what I get when I use the script you provided, I pointed at the light blue color in the "au3" word.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

 

Are you by chance trying to pull the color from a 3D app?

 
 
No, it isn't
 

n4Wod.jpg

 

That's what I get when I use the script you provided, I pointed at the light blue color in the "au3" word.

 

 

Try to use other little programm (like 500x500) maybe you get the right value becuase the browser is full screen. 

Look at setting pixelcoordmode as well as mousecoordmode.

 

This is a good solution but i don't understand why adding handle variable at function doesn't work  :ermm:

Anyway i want get the pixel color while the window are not active. With AutoItSetOption i can only get the thinks of active windows. I really want solve this problem with PixelGetColour because it's the best way for my program. Maybe i add somenthink wrong at variable $handle ??

Please help me.

Edited by akroon

Share this post


Link to post
Share on other sites


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Share this post


Link to post
Share on other sites

So you want to get the colour of a pixel in a window that is not visible on the screen?

 

No, the windows is on the screen but is not active ("selected")

Share this post


Link to post
Share on other sites

Ok i try to explain better. I have this "program" working at the corner of the screen, so i want get pixelcolor while the autoitprogram is working on another program. If you don't understand i can make some screenshot for show the situation.

Share this post


Link to post
Share on other sites

akroon,

 

i can make some screenshot for show the situation

An excellent idea! :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

post-84086-0-78312200-1390843936_thumb.p

Here's the screenshot

I want just this: the pixelgetcolor will work on the window not depending of its position ( i want be free to put where i want on the screen so can't use desktop mode)

Edited by akroon

Share this post


Link to post
Share on other sites

Seeing you want to work with a webpage - you can use the IE controls built into AutoIt and do what you want with IE.

 

No the "program" is .exe

 

Seeing you say that above when I asked you if the app was a web based application and you show a screenshot of a web browser later - that tells me you are really trying to NOT say what the name of the application is.

Cut the bullshit. What is the name of the application? So far you are wasting our time with your refusal to be straight with us.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0