Sign in to follow this  
Followers 0
bfg

C# WinForms GUI Button click problem!

4 posts in this topic

Hi there,

I am trying to emulate a button being clicked using AutoIt, on a C# WinForms (.net 2.0) GUI. The problem is the ID and Handle seem to change everytime the button is opened, I have tried this method:

ControlClick("myForm", "", 1001)

But the button ID changes everytime the GUI form is opened. So I tried this using the buttons Handle instead:

#Include <GuiButton.au3>

Send("{tab 5}")

_GUICtrlButton_Click(0x001804D6)

This tabs to the button, then forces a click, but the handle changes everytime the GUI is opened! Anyone know how I can specify that particular button to click, say using something like _GUICtrlButton_Click() ? Ideally I'd rather not use the button name, as there is a chance this might be duplicated.

Thanks!

Share this post


Link to post
Share on other sites



Most .Net forms are hard to interact with. You have to reference them by text, or by position.

Share this post


Link to post
Share on other sites

Hi,

Thanks for the replies, yeh IDs are not good for .net controls, I'd rather not reference by button text incase there are duplicated control texts. Its ok though I found use with that ScriptWriter addon for AutoIt to record mouse clicks instead of specifying ID's.

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