Sign in to follow this  
Followers 0
kiwikid

Retrieving classname of a window that has focus

9 posts in this topic

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.

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

what is this for exactly, there may be another way around the problem

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

what is this for exactly, there may be another way around the problem

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0