Jump to content

Radio Button


Abhay
 Share

Recommended Posts

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
Link to comment
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.

Link to comment
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
Link to comment
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?

Link to comment
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)

Link to comment
Share on other sites

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
Link to comment
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)
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...