WestCBear Posted March 28, 2016 Share Posted March 28, 2016 (edited) Hi All, This is a simple request. I just need someone to point me in the right direction with the following: I need to capture a pressed button event on an external window. For example, if a button is pressed in an external window, my AutoIT program will do something. (Or is this way more complicated than I realize?) Thanks! WestCBear Edited March 28, 2016 by WestCBear Link to comment Share on other sites More sharing options...
InunoTaishou Posted March 29, 2016 Share Posted March 29, 2016 A window button or a keyboard button? Why do you need to capture an event for another program? What program are you trying to automate? Link to comment Share on other sites More sharing options...
AutoBert Posted March 29, 2016 Share Posted March 29, 2016 1 hour ago, WestCBear said: Or is this way more complicated than I realize? It's not easy. There are more details needed, like: OS is Au3Info.exe able getting Infos about: Window: hwnd or title, position Control: ID, position relativ to window Link to comment Share on other sites More sharing options...
junkew Posted March 29, 2016 Share Posted March 29, 2016 Look at the event examples in example thread on iuiautomation If something is difficult depends on your knowledge and experience so hard to say if its easy or difficult. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
WestCBear Posted April 6, 2016 Author Share Posted April 6, 2016 On 03/29/2016 at 6:26 PM, AutoBert said: It's not easy. There are more details needed, like: OS is Au3Info.exe able getting Infos about: Window: hwnd or title, position Control: ID, position relativ to window Hi AutoBert, The OS is Windows 7 Au3Info.exe is able to get both the Window title and the control name of the button pressed. I feel like there is simple function that will help, but I'm not sure which one. WestCBear Link to comment Share on other sites More sharing options...
alien4u Posted April 7, 2016 Share Posted April 7, 2016 Something like this should help you(pseudo code): If ExternalWindows exists(See WinExists() on help file) Then While loop until you found if the button is pressed or clicked. - Find a way to know if the button is pressed (check if the button state change or button text change on click or action with Au3Info) . - Check if the external Windows do something or change something if that button is pressed is another way to detect if the button was clicked. Do what you want to do. Something like that should help. In order to help more we need more info, code you already try, more info about the window or button, what is the button action what the external windows show or do on this button action. Happy Coding Kind Regards Alien. Link to comment Share on other sites More sharing options...
InunoTaishou Posted April 7, 2016 Share Posted April 7, 2016 You can do it more efficiently using a hook. Look at Quote _WinAPI_SetWinEventHook In the help file. It's possible, and pretty easy to do. Link to comment Share on other sites More sharing options...
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