phpjunkie Posted October 2, 2021 Share Posted October 2, 2021 How would one go about getting the CLASS name of an application for WinWaitActive? Link to comment Share on other sites More sharing options...
AlessandroAvolio Posted October 2, 2021 Share Posted October 2, 2021 (edited) Hi! You can get window class name by using _WinAPI_GetClassName function: https://www.autoitscript.com/autoit3/docs/libfunctions/_WinAPI_GetClassName.htm You'll need to give as first parameter at least a window title or a window handle. If you don't know already before the window title, you can still obtain the window handle by using WinGetHandle function on an active window: $hWnd = WinGetHandle("[ACTIVE]") Edited October 2, 2021 by AlessandroAvolio Link to comment Share on other sites More sharing options...
JockoDundee Posted October 2, 2021 Share Posted October 2, 2021 This: Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
AlessandroAvolio Posted October 2, 2021 Share Posted October 2, 2021 The window has several controls. No program can currently read your mind and select the control you think. What you can do instead is have the list of all the controls. You can use the function WinGetClassList() that retrieves the classes from a window. #include <MsgBoxConstants.au3> Main() Func Main() ; Run Wordpad Run("write") ; Wait 10 seconds for the Notepad window to appear. Local $hWnd = WinWait("[CLASS:WordPadClass]", "", 10) ; Retrieve the classlist of the Wordpad window using the handle returned by WinWait. Local $sClassList = WinGetClassList($hWnd) ; Display the classlist. MsgBox($MB_SYSTEMMODAL, "", $sClassList) ; Close the Wordpad window using the handle returned by WinWait. WinClose($hWnd) EndFunc Link to comment Share on other sites More sharing options...
JockoDundee Posted October 2, 2021 Share Posted October 2, 2021 1 hour ago, AlessandroAvolio said: The window has several controls. No program can currently read your mind and select the control you think. What you can do instead is have the list of all the controls. Who said anything about controls? I think he just wants to know the class of the window so he can WinWait for it to show up. Code hard, but don’t hard code... Link to comment Share on other sites More sharing options...
AlessandroAvolio Posted October 2, 2021 Share Posted October 2, 2021 (edited) 26 minutes ago, JockoDundee said: Who said anything about controls? I think he just wants to know the class of the window so he can WinWait for it to show up. I'm sorry,I thought I was speaking to op... in fact at first I couldn't understand your answer, I ended up believing the author was asking me something more specific, with the help of a screenshot. I thought you were talking about controls having noticed a red box around RICHEDIT50W in the screenshot. Edited October 2, 2021 by AlessandroAvolio Link to comment Share on other sites More sharing options...
JockoDundee Posted October 3, 2021 Share Posted October 3, 2021 2 hours ago, AlessandroAvolio said: with the help of a screenshot. I thought you were talking about controls having noticed a red box around RICHEDIT50W in the screenshot. No worries. It wasn’t my screenshot, if it was I would have circled the class field. OP probably figured it out by now. Code hard, but don’t hard code... 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