Jump to content

Simply clicking a button


steve06
 Share

Recommended Posts

Im very new to all this, just trying to figure out how to automate a button click. For example i am just trying to make a GUI with a button that says defrag and then once clicked i want it to open the defrag application and click on the button to start it.

This is my case within a while loop:

Run('dfrgui.exe')

WinWaitActive("Disk Defragmenter")

Send("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}")

This was working but has now stopped for some reason. I would prefer it if there was a way I could simply automate the programme to send a click to 'button 2' ...? Any help would be great. Thanks

Link to comment
Share on other sites

I'm guessing that defrag has command line switches so I think this would be the wrong way to go about your task.

For ideas about how to acheive your goal, take a look at Valuaters MAXOFF program, which I think employs it.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I agree with JohnOne, but if you just want to restore the old scripts functionality you should be able to use this:

Run('dfrgui.exe')
$hWnd = WinWaitActive("Disk Defragmenter")
ControlClick($hWnd,"","[CLASSNN:Button3]")

Make sure the windows title is "Disk Defragmenter". If it doesn't work, use the au3info tool to confirm the button you want to click has the CLASSNN "Button3".

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...