Jump to content
Sign in to follow this  
Vladi243

Read button color

Recommended Posts

Vladi243

Hi :P

I made that the button will change its color on click. Now I want to make a script that read the color of the button.

I search a lot in the help file, and didn't find any function that read the color of the button.

Can you help me with it?

Share this post


Link to post
Share on other sites
TerarinKerowyn

Will PixelGetColor ( x , y [, hwnd] ) help you out here?


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites
Vladi243

I saw this function in the help file, but it's not effective because the GUI can be moved.

Share this post


Link to post
Share on other sites
ProgAndy

If it's your button, just save the color to a variable :P


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
Vladi243

If it's your button, just save the color to a variable :P

I can't understand how it helps me to read the color of the button. The color always changes.

Share this post


Link to post
Share on other sites
billthecreator

when you click the button and it changes colors, also have it save to a variable, like above. like this:

$button = guictrlcreatebutton("", 20,20,20,20)
guictrlsetbkcolor(-1,"0xFF0000")

while 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $button
            $color = ;the color here
                        Guictrlsetbkcolor($button,$color)
    EndSwitch
wend

that way, you can call $color somewhere else, and thats the color of the button


[font=Microsoft Sans Serif]My Scripts: From Most recent to least.[/font]Countdown GUI | QLOCK TWO | FlipClock | Slot Machine My UDF:_GenerateRandomNoRepeat | _GuiSnap

Share this post


Link to post
Share on other sites
TerarinKerowyn

You should be able to link it directly to the control using PixelCoordMode linked up with the client and then you should be able to find the button

Can we see the code work I can better explain it to you


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites
Vladi243

when you click the button and it changes colors, also have it save to a variable, like above. like this:

$button = guictrlcreatebutton("", 20,20,20,20)
guictrlsetbkcolor(-1,"0xFF0000")

while 1
$nMsg = GUIGetMsg()
    Switch $nMsg
        Case $button
            $color = ;the color here
                        Guictrlsetbkcolor($button,$color)
    EndSwitch
wend

that way, you can call $color somewhere else, and thats the color of the button

I know how to change the color.

I need a function that reads the current color of the button.

Share this post


Link to post
Share on other sites
Vladi243

You should be able to link it directly to the control using PixelCoordMode linked up with the client and then you should be able to find the button

Can we see the code work I can better explain it to you

Sorry I can't show my code.

Share this post


Link to post
Share on other sites
ProgAndy

YOU have made a button. YOU made, that it changes it's color.

So, ON CHANGING the color SAVE it to a variable at this time, and when you want to know the color, READ the variable !!


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
TerarinKerowyn

Then I cannot help you then if you won't show us your code. Anyways he is trying to find the color of the button aside from the color changing function. In other words they are two seperate functions and he doesn't want to carry the functions colorchange with it so he must find the color entirely, am I right? In other words you must use PixelGetColor but there is a way to follow the scroll or whatever makes the function move those making it impossible for us to help him out by not giving us the codework behind it all


Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah

Share this post


Link to post
Share on other sites
Vladi243

have it so when you click the button, it calls this function...

Func:

Func GuiCtrlGetColor()
    $a=GUIGetCursorInfo()
    $color = PixelGetColor($a[0],$a[1])
EndFunc
It's much better.

Thanks to all who helped me :P

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  

×