Sign in to follow this  
Followers 0
ksdjfh

new to autoit, need help selecting radio button

4 posts in this topic

I’m very new to AutoIt and I need help clicking a radio button in Windows.
 
Basically i'm going to create script (compiled to an exe) to do some stuff on first logon for new users.
 
I want to open the performance settings and click the adjust for best performance radio button.
 
I managed to put together the following bit of code to open the dialog box (first 3 lines are needed for something like XP, the last run last will open it directly if I’m running vista or later which is the preferred method apparently). I can’t figure out how to click the adjust for best performance and then click the OK button to dismiss the dialog box (2 Oks needed for win xp, only 1 for the others). Can anyone help? (There might be more than just English involved so I don’t know if trying to find that radio button by name or position is best)

In the code below, i don't even fully understand how the control click line is able to call up the correct dialog box. when i test on 2K8R2 for example, it works but I'm not even sure how it's clicking the right thing.

#include <GUITreeView.au3>

If @OSVersion = 'WIN_XP' Then
   Run('control sysdm.cpl,,3')
   WinWaitActive('System Properties')
   ControlClick('System Properties', '', 'Button2')
Else
   Run('SystemPropertiesPerformance.exe')
   WinWaitActive('Performance Options')
EndIf

Thanks

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, Welcome to Autoit Forum.

 

Use somethin like this.   

#include <GUITreeView.au3>

If @OSVersion = 'WIN_XP' Then
   Run('control sysdm.cpl,,3')
WinWaitActive('Propiedades del sistema')
ControlClick("[CLASS:#32770]", "", "Button2")
WinWaitActive('Opciones de rendimiento')
ControlClick("[CLASS:#32770]", "", "Button3")
Else
   Run('SystemPropertiesPerformance.exe')
   WinWaitActive('Performance Options')
EndIf

change the titles for English Version.

saludos

Edited by Danyfirex

Share this post


Link to post
Share on other sites

@ksdjh - You need to investigate the Window Title commands in the Help file, and the Window Info Tool that was installed with AutoIt. They should give you a clearer understanding, but don't hesitate to ask here if you aren't clear on what they tell you or can't figure how to implement what you want.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

Hi Danyfirex and TheSaint,

Thanks for the replies. With the sample code and the pointer to the help and window tool, I've managed to get my script working.

Much appreciated

1 person likes this

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