Jump to content

C# WinForms GUI Button click problem!


bfg
 Share

Recommended Posts

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!

Link to comment
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.

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