bfg Posted June 23, 2008 Posted June 23, 2008 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!
zfisherdrums Posted June 23, 2008 Posted June 23, 2008 Hello bfg, As you have noted, IDs are not the most persistent identifiers when it comes to .NET controls. Can you reference them by their text? Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog...
Richard Robertson Posted June 23, 2008 Posted June 23, 2008 Most .Net forms are hard to interact with. You have to reference them by text, or by position.
bfg Posted June 24, 2008 Author Posted June 24, 2008 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now