kiwikid Posted June 20, 2007 Share Posted June 20, 2007 How do I retrieve the classname of a window that has focus. For instance, clicking on the Start Button, the classname as shown in AutoIT Window Info Tool is Shell_TrayWnd. Thanks for the help in advance. Link to comment Share on other sites More sharing options...
DW1 Posted June 20, 2007 Share Posted June 20, 2007 does this help $text = WinGetClassList("", "") MsgBox(0, "Class's in current window are: ", $text) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
kiwikid Posted June 20, 2007 Author Share Posted June 20, 2007 does this help c2--><!--JiMwMzY7dGV4dCA9IFdpbkdldENsYXNzTGlzdCgmcXVvdDsmcXVvdDssICZxdW90OyZxdW90OykKTXNnQm94KDAsICZxdW90O0Ns YXNzJiMzOTtzIGluIGN1cnJlbnQgd2luZG93IGFyZTogJnF1b3Q7LCAmIzAzNjt0ZXh0KQ==--><!--eg Yeah I tried that one and it didn't work correctly. It showed the entire class list with exception to the one that was required. What was displayed given your code was: Button TrayNotifyWnd TrayClockWClass SysPager ToolbarWindow32 Button ReBarWindow32 MSTaskSwWClass ToolbarWindow32 ToolbarWindow32 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 20, 2007 Moderators Share Posted June 20, 2007 http://www.autoitscript.com/forum/index.ph...c=32781&hl=http://www.autoitscript.com/forum/index.ph...c=30717&hl= Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kiwikid Posted June 20, 2007 Author Share Posted June 20, 2007 http://www.autoitscript.com/forum/index.ph...c=32781&hl=http://www.autoitscript.com/forum/index.ph...c=30717&hl=I tried your code and it didn't get me exactly what I wanted. What it did do was provide me with more questions. For instance using the AutoIT Window Info Tool, the class name for the start button is Shell_TrayWnd. Additionally the control class states it's a Button with the instance of 1 with a Control ID of 304. Your code lines up perfectly with what's stated for the classname of the control, but not for the window. Do you have anything that pulls the window classname info? Link to comment Share on other sites More sharing options...
DW1 Posted June 20, 2007 Share Posted June 20, 2007 what is this for exactly, there may be another way around the problem AutoIt3 Online Help Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 20, 2007 Moderators Share Posted June 20, 2007 I tried your code and it didn't get me exactly what I wanted. What it did do was provide me with more questions. For instance using the AutoIT Window Info Tool, the class name for the start button is Shell_TrayWnd. Additionally the control class states it's a Button with the instance of 1 with a Control ID of 304. Your code lines up perfectly with what's stated for the classname of the control, but not for the window. Do you have anything that pulls the window classname info?Ahh, I thought you wanted the ClassNameNN!!! ... yes something like this: http://www.autoitscript.com/forum/index.ph...st&p=233556 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
kiwikid Posted June 20, 2007 Author Share Posted June 20, 2007 what is this for exactly, there may be another way around the problemWhat I'm working on for work is creating an automated testing solution. One of the requirement is error correction for two reasons. First we need to run through negative test results. Secondly I need to write out everything to a log report to determine where a script may have gone wrong as well as what it has completed. It's in this where I need the as much information about the window and control that has focus to help isolate the problem in the script and posisbly provide corrective action. Right now I'm capable of getting the Control ID which helps significantly in ensuring the automated test procedure hasn't skipped steps due to sending mouseclicks and keystrokes to the wrong control. Heading further down this rabbit hole, getting more information such as text of the Control (which makes it easier to a user to identify what went wrong) as well as the classname of the window aids tremendously. Users have no clue that Control ID 304 means the Start Button for instance; however the text "Start" does help. Anyways I hope that helps illustrate why this information is important to me. Thanks so far, for all the help. Link to comment Share on other sites More sharing options...
kiwikid Posted June 20, 2007 Author Share Posted June 20, 2007 Ahh, I thought you wanted the ClassNameNN!!! ... yes something like this: http://www.autoitscript.com/forum/index.ph...st&p=233556SmOke_N - You rock! I love that it's short and sweet. This totally meets my requirements. Thanks again! 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