Sign in to follow this  
Followers 0
Abhay

Radio Button

14 posts in this topic

#1 ·  Posted (edited)

There are three radio buttons on the setup GUI and each has text associated with it. Can I select/deselect any of those radio buttons based on the text associated with them?

Help will be appreciated.

Edited by Abhay

Share this post


Link to post
Share on other sites



There are three radio buttons on the setup GUI and each has text associated with it. Can I select/deselect any of those radio buttons based on the text associated with them?

Help will be appreciated.

I can select radio button by sending tab ({TAB}) or by using co ordinates from info tool. I don't want it this way as if in future radio buttons are swapped then we will again need to edit the script.

Share this post


Link to post
Share on other sites

do u mean like clicking on the text next to the radio buttons to select and deselect them?

Share this post


Link to post
Share on other sites

Absolutely correct Bam, that way only.

Share this post


Link to post
Share on other sites

well with this u can click the text or the circle

#include <GUIConstantsEx.au3>

GUICreate("Radio Test", 200, 100)

GUIStartGroup()
$radio_1 = GUICtrlCreateRadio("Radio &0", 10, 10, 70, 20)
$radio_2 = GUICtrlCreateRadio("Radio &1", 10, 40, 60, 20)
$radio_3 = GUICtrlCreateRadio("Radio &2", 10, 70, 60, 20)
GUICtrlSetState($radio_1, $GUI_CHECKED)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $msg = $radio_1 Or $msg = $radio_2 Or $msg = $radio_3
            $radioval1 = $msg - $radio_1
    EndSelect
WEnd

Share this post


Link to post
Share on other sites

Thanks but this was not an issue.

By your script above we are creating the GUI with title Radio test and three radio buttons on that.

I am writing script to automate installation wherein installer has many screens or UI and some of them have couple of radio buttons.

Here consider that one of the screen has three radio buttons, each means different option like one is for local default installation path other is for remote installation path and so on

So I just want to select 2nd radio button and by default radio button 1 is selected.

Radio Button no Text associated.

1 Local installation

2 Remote installation

3 Local non default installation

How to do that?

Share this post


Link to post
Share on other sites

ahh i think i know what u mean now, you might wana look at ControlClick

example:

ControlClick($Subject, "", "[CLASS:ToolbarWindow32; INSTANCE:1]","left", 1, 25, 25)

this will click the "Send" button on outlook express (after u clicked create mail to bring up the window with the "Send" button in it)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

We can do that based on controls, correct?

So AutoIT windows info can show us different things like Object ID, text, mouse co ordinates etc.

So based on text associated with can we select that radio button?

I will try with what you posted above. Actually I tried that before but let me see that again.

Edited by Abhay

Share this post


Link to post
Share on other sites

what is 1, 25, 25 above, are they co ordinates of the radio button?

Share this post


Link to post
Share on other sites

what is 1, 25, 25 above, are they co ordinates of the radio button?

1 = number of mouse clicks

and 25,25 = x y cords

you can probly change tho to 0, thier just offseting the click postion closer into the middle of the botten

while useing controlclick you dont even need the window to be active for it to click the botten :)

i found an old test i had for ya that uses calculator

must open calculator befor runing and only clicks number 7...

WinActivate ("Calculator")
Sleep(2000)
ControlClick("Calculator", "", "[CLASS:Button; INSTANCE:5]","left", 1, 0, 0)

Share this post


Link to post
Share on other sites

It worked on calculator, however when tried for the radio button on the setup screen it didn't.

I changed the parameters correctly here is that:

ControlClick("Command", "", "[CLASS:Button; INSTANCE:6]","left", 2, 23, 7)

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

you can look in the help file and go under control click that have acouple different ways of doing with controlclick i dont have program ur trying to controlclick with, kinda on your own from thier :)

only thing i can say is change "[CLASS:Button; INSTANCE:6]" untill you find 1 that works and

make sure your ("left", 2, 23, 7) 23 and 7 are not offseting to much idk if they would click outside if it or not, one thing you could try is a loop that would count 1-100 x then reset and add 10 to y or somthen... GL :)

Edit: yes you can offset to much and ull miss where you want it to click

Edited by Bam

Share this post


Link to post
Share on other sites

Thanks a ton Bam, I could do that with controlclick however we have to provide controlID there.

Looks like there is no way I can select radio buttons as per the text associated with it.

Share this post


Link to post
Share on other sites

have u tried tabing thro it? idk u might be able to select the option after so many tabs

or u could try geting the window position and hight, width and maybe geting a mousepos that way

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