Jump to content
Sign in to follow this  

Pressing CheckBoxes and RadioButtons in Script

Recommended Posts

Hello everyone,

I'm running a script to automatically follow the steps of an installation wizard and i'm having trouble pressing the buttons when they are not regular (Back, Next, Cancel, Finish, etc.) buttons.

I'm using the following to press normal buttons and it works just fine:

ControlClick("Setup - SafeCom G3", "&Next >", "TNewButton1")

Every time i need to press a Check Box or select a Radio type button i get stuck in the script.

This are examples of the buttons i need to press:


If i'm not mistaken, the command to press that button would be:

ControlClick("Setup - SafeCom G3", "I &accept the agreement", "TNewRadioButton1")



The command i' trying to use here would be:

ControlClick("Setup - SafeCom G3", "", "TNewCheckListBox1", 10, 31)

However, it is not working.

Someone with some experience in this can help me?


Thanks a lot.

Best regards.

Share this post

Link to post
Share on other sites

If you look at the remarks for ControlClick in the Help File.

Some controls will resist clicking unless they are the active window. Use the WinActivate() function to force the control's window to the top before using ControlClick().

For example, try this before each ControlClick.

$sWinTitle = "Setup - SafeCom G3"
$sWinText = ""
If Not WinActive($sWinTitle, $sWinText) Then WinActivate($sWinTitle, $sWinText)
WinWaitActive($sWinTitle, $sWinText)
ControlClick($sWinTitle, $sWinText, "TNewRadioButton1")

It may seem redundant, but some times Windows my cause the window to loose focus, and stops the script from clicking correctly. This snippet prevents it. The WinWaitActive allow the script to make sure that the window is active after the WinActivate call. There can be some lag on some older systems. I have used this snippet quite a few times in situations like 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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...