Sign in to follow this  
Followers 0
MarauderNL

Get pixel color from within a control

3 posts in this topic

Hi there!

I've got a slight problem, I'm using AutoIt for this program called EeRom-8U.

Basically what I'm doing is taking a file that got generated by a programming enviroment (CodeWright) and use EeRom to load it onto an emulator (used to test our gambling machine games before we put them onto a chip)

The problem is this: The script works but is pretty sloppy. When I start up EeRom, it has to check wether the emulators are connected. I wanted to do this by checking if the text "not connected!" would have changed to "ERU#### / 2.0", but that doesn't work since the Window tool doesn't pick up the text.

So my next idea was to see if the location of the "!" was black, that would mean it's not connected. If it was grey (the background color) it would mean it's connection.

However, how do I manage to tell PixelGetColor that the coordinates should be calculated from within the control, and not the screen?

Thanks in advance!

Share this post


Link to post
Share on other sites



MarauderNL,

Had to look this up myself yesterday, so it is nice and fresh in the memory! You need to adjust the PixelCoordMode through the Opt function. From the Help file for Opt:

PixelCoordMode Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the window defined by hwnd (default active window):

0 = relative coords to the defined window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the defined window

Use the Au3Info tool to get the hwnd and set Mode 0 or 2. That should do it! Do not forget to reset the mode when you are done or you might get a nasty surprise when you next use a Pixel function - the current mode is returned when you set a new one, so it is easy to save it in a variable.

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

That worked! Awesome! Thanks a bunch!

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