I am using AutoIT to automate installation of a software. In a window, I am being shown with 2 radio buttons, say radio1 and radio2. By default the radio2 is selected. The default control is on radio2 radio button. I have to select the radio1. I am able to make the control go to the radio1 by using Send("{TAB}") as many times so that the control goes to the radio1 but I am not getting what should be the command to click on the first radio button. The SEND("{ENTER}") doesnt work in this condition. Please guide.
2 回答
As you'd know, using ControlCommand is better practice than Send. I understand that you found it difficult to get the control's ID using AutoIT v3 Window Info, which happens some times. There are some other good window information tools I use in those circumstances: winspector / AccExplorer32.exe / inspect32.exe / WindowHandlePicker.exe.
You have several options:
1) Use the following snippet and increase the number in CLASSNN until you get the right checkbox:
ControlCommand("Options", "", "[CLASSNN:Button5]", "Check")
2) Some of the window info tools listed above tell you the shortcut key for the control (eg. alt+u). If that's the case, it's sometimes possible to send the shortcut without specifying the control:
ControlSend("Options", "", "", "!u")
3) Using _CtrlGetByPos, get the control's ID/CLASSNN/Handle then use it in a ControlClick.
4) Just use Send("{SPACE}")
as mrt's mentioned
You mean by using Send("{TAB}")
you are able to give focus to the radio buttons (the dotted line) but you can't activate them? If this is the case then you can try Send("{SPACE}")
to activate the proper radio-button.