Sign in to follow this  
Followers 0
DocMarten

Check works, UnCheck and IsChecked don�t: Any help for getting radio button status?

17 posts in this topic

Hello all,

its only some weeks ago that I discovered tired from frustrating experiment with wsh autoit which allows even a non-programmer like me to make nice little programms. I am really pretty addicted yet :)

I found autoit when I was looking for a tool that allowes me to map functions of my multizone audio setup on a radio controlled remote command via PC.

The programm I want to controll is the kxproject sound driver (http://kxproject.lugosoft.com/intro.php), especially the kxmixer which doesnt offer keyboard shortcuts. Almost everything works perfect with my autoit scripts that control the volume sliders, I only have one problem with the Mute radio button. It seems that I cant find a way to get its staus (checked or not checked). I want to know this because, thinking of the WAF :D, I want my media center to behave like a normal TV or Hifi equipment, i.e.: when it is muted and you touch the Volume+ Button, the sound should be activated (i.e. uncheck mute) before increasing the volume.

First I thought that it might not be a standard Windows Button, as IsChecked doesnt seem to work, neither Uncheck. Strange enough, Check does work, but it only toggles the button.

I then tried to get the status via the color change between checked and unchecked. Basically, this works, but it has a big drawback: I have to make the Window visible (with WinActivate ( "Mixer - SB0102 5.1 [d400]", 5 )) to get the coordinates of the button, the to hide it again because it comes in front of my fullscreen media portal screen. Even more, the focus does not alway find its way back to media portal, so when I press the volume button on the remote again, the status of the radio button is not checked correctly sometimes. For this reason, I made the work around to click in a corner of the media portal window, but this has undesired effects (showing context menues etc.:

WinSetState ( "Mixer - SB0102 5.1 [d400]", "", @SW_MINIMIZE )
MouseClick ( "RIGHT" , 800, 600 ,1 )

So my question to the power users is: Any idea how I can get the state of these radio buttons in a more elegant fashion?

Here is the code of my script:

WinActivate ( "Mixer - SB0102 5.1 [d400]", 5 )
AutoItSetOption ( "PixelCoordMode", 0 )
;get position of mute button control
$pos = ControlGetPos ( "Mixer - SB0102 5.1 [d400]", "", 2305 )

;move position a little bit to get it into the area of color changes
$offset = 5
$xpos = $pos[0] + $offset
$ypos = $pos[1] + $offset

;Put focus on mute button
ControlFocus ( "Mixer - SB0102 5.1 [d400]", "", 2305)

;Read color information
$var = PixelGetColor( $xpos, $ypos)

;if button is checked (sound = off), uncheck and then increase volume 10 steps
if $var = 14145495 Then
   ;ControlFocus ( "Mixer - SB0102 5.1 [d400]", "", 2305)
    ControlCommand ( "Mixer - SB0102 5.1 [d400]", "", 2305, "CHECK" )
    ControlSend ( "Mixer - SB0102 5.1 [d400]", "Analog Hinten", 1793, "{DOWN 10}" , 0 )
;if button is not checked (sound = on), increase volume 10 steps
Else
    ControlSend ( "Mixer - SB0102 5.1 [d400]", "Analog Hinten", 1793, "{DOWN 10}" , 0 )
    endIf
WinSetState ( "Mixer - SB0102 5.1 [d400]", "", @SW_MINIMIZE )
MouseClick ( "RIGHT" , 800, 600 ,1 )

Any help would be greatly appreciated.

Best regards

Martin

Share this post


Link to post
Share on other sites



GuiCtrlGetState($control) ; should work


F@m!ly Guy Fr33k! - Avatar speaks for itself__________________________________________________________________________________________ite quotes... - Is your refrigerator running? If it is, It probably runs like you...very homosexually - Christians don't believe in gravity - Geeze Brian where do you think you are, Payless?- Show me potato Salad!__________________________________________________________________________________________Programs available - Shutdown timer[indent][/indent]

Share this post


Link to post
Share on other sites

Thanks

GuiCtrlGetState($control) ; should work
Sounds great, I'll try as soon as I lay hands on my media pc this night. I thought all the GUI... stuff was only for "home made" GUIs.

cu

Martin

Share this post


Link to post
Share on other sites

GuiCtrlGetState($control) ; should work
I don't think that is going to work, it's not a self built application your trying to get the status of, guictrlGetState is for a gui you have built in autoit.

It would be ControlCommand that you would be looking at and the ischecked function within.

Share this post


Link to post
Share on other sites

ChrisL,

It would be ControlCommand that you would be looking at and the ischecked function within.

That was the first thing I tried, but it doesn't seem to retrieve the state of the button.

cu

Martin

Share this post


Link to post
Share on other sites

Hmm..., unfortunately, eynsteyn's idea doesn't seem to work - I still can't retrieve the state (checked or not) of this radio button.

Is anybody able to read from the window information below whether this this radio button is a standard windows button? As I already mentioned, I can adress it with ControlCommand..., CHECK does work, Uncheck and IsChecked don't:

Press CTRL-ALT-F to freeze the display.

>>>>>>>>>>>> Window Details <<<<<<<<<<<<<
Title:  Mixer - SB0102 5.1 [d400]
Class:  Afx:1000000:2b:10011:1100056:7c0503:kXMain
Size:   X: 75   Y: 26   W: 600  H: 340

>>>>>>>>>>> Mouse Details <<<<<<<<<<<
Screen: X: 156  Y: 160
Cursor ID:  2

>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<
RGB:    Hex: 0x1C792D   Dec: 1866029

>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<
Size:       X: 75   Y: 130  W: 14   H: 10
Control ID: 2304
ClassNameNN:    Button18
Text:       Aktivieren
Style:      0x5000000B
ExStyle:        0x00000000

>>>>>>>>>>> Status Bar Text <<<<<<<<<<<


>>>>>>>>>>> Visible Window Text <<<<<<<<<<<
Master
Ein- und Ausgnge
Aufnahme
AC97
FX

...

>>>>>>>>>>> Hidden Window Text <<<<<<<<<<<

cu

Martin

Share this post


Link to post
Share on other sites

...Control ID: 2304...

Your copy/paste of the "info tool" data shows 2304 and yet nowhere in your code in the original post is a controlID with that number?

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

post-19654-1168464848_thumb.jpgYou are right, I have not been precise - 2304 is another mute radio button I also want to control - there are lots of them :) But the problem ist the same. I have uploaded a screenshot of the mixer skin, perhaps this helps to get things clear. The buttons are the small dots below the sliders. The first two (greyed out in the screenshot) are 2304 and 2305.

cu

Martin

Share this post


Link to post
Share on other sites

...First I thought that it might not be a standard Windows Button, as "IsChecked" doesn't seem to work, neither "Uncheck". Strange enough, "Check" does work, but it only toggles the button...

I have a few apps that are non-standard and only a few of the Control.... funcs work. This might be the case here.

The help file states that "IsChecked" Returns 1 if Button is checked, 0 otherwise

You say that it does not work... but what does it return? Always 0?

Post the one or two lines of code that you would/have use(d) to check that.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I have a few apps that are non-standard and only a few of the Control.... funcs work. This might be the case here.

The help file states that "IsChecked" Returns 1 if Button is checked, 0 otherwise

You say that it does not work... but what does it return? Always 0?

Post the one or two lines of code that you would/have use(d) to check that.

This is the test:

ControlFocus ( "Mixer - SB0102 5.1 [d400]", "", 2304)
ControlCommand ( "Mixer - SB0102 5.1 [d400]", "", 2304, "CHECK" )
$A_status = ControlCommand ( "Mixer - SB0102 5.1 [d400]", "", 2304, "ISCHECKED" )
MsgBox (0, "Speaker Status", "1 On: " & $A_status)

The mute button toggles allright, but the status that is returned is always 0.

cu

Martin

Share this post


Link to post
Share on other sites

Then you have your answer. It won't work. You have done what the help file asks:

...but may resist automation. Experiment!


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Then you have your answer. It won't work. You have done what the help file asks:

...but may resist automation. Experiment!

That's right, but the fact that ist does not work was the reason for me to start this thread :) - and believe me, I have been experimenting for many, many hours, up to the point that my friends stated that it seemed that my life depends on retrieving the status of this lousy little radio button...

What I was hoping for was a new idea for a workaround from an experimented autoit user, as my experiments with the color method were not satisfactory... I have also thoght of getting the mute status from the digit fild above the sliders (which shows "inF" when muted and the volume number when not), but it resists also to be read by autoit (I believe that it is not actually a digit filed, but a image). The problem is that the alternative mixer software I found to be used for my multizone audio purposes (http://www.zvolume.com) behaves exactly the same way, while a third mixer capable of managing several stereo outputs independently and comes with standard windows ccontrols (Sound Control) crashes during startup...

So I still would be very greatful for any hint or workaround idea.

cu

Martin

Share this post


Link to post
Share on other sites

Perhaps the DLL route would work for this - grasping at straws here.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

Perhaps the DLL route would work for this - grasping at straws here.

hui... you mean the stuff discussed in http://www.autoitscript.com/forum/index.ph...&hl=dllcall. I feel fear creeping up my back - I think this may be too hard for me as non-programmer, and I was not able to find much documentation on this (is a real programmer supposed to know what's inside the dlls and how to call it?)

cu

Martin

Share this post


Link to post
Share on other sites

...(is a real programmer supposed to know what's inside the dlls and how to call it?)...

I'm not a real programmer, but I play one on...... :-)

There was a thread that mentioned some tools to use when exploring DLLs and maybe some "how to use it" info when it comes to AutoIt. Maybe someone will post a link to that.


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

I ran into the exact same issue with "Uncheck" & "IsChecked" ControlCommands as DocMarten had discribed here thus I wonder if there have been any resolution for this issue? If so please help.

Hi DocMarten, you has brought up this issue back in 2007 since then have you got any work around solution for this? Any suggestion and feed back would be very much appreciated. Many thanks

Share this post


Link to post
Share on other sites

I ran into the exact same issue with "Uncheck" & "IsChecked" ControlCommands as DocMarten had discribed here thus I wonder if there have been any resolution for this issue? If so please help.

Hi DocMarten, you has brought up this issue back in 2007 since then have you got any work around solution for this? Any suggestion and feed back would be very much appreciated. Many thanks

DocMarten hasn't been online since 2007. You should open a new thread and not revive a 5+ year old thread to say that you have the same issue.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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