Jump to content

controlling windows with unknown/non-unique titles


Recommended Posts

Hi. I would like to control several windows that match the same class but whose titles are unpredictable. If I try to control them by class, I can only control one of them (apparently the first one in the list that matches my class string). If I try to obtain the list of windows using WinList, then it is impossible to tell the class of each window since WinList only returns the title string and the handle.

As a simple example, suppose you wanted to move three different pre-existing explorer windows. You could move one of them directly using WinMove("[CLASS:ExploreWClass]", ...). But you could not move any of the others. Calling WinList would return a bunch of titles and handles but you would have no way of knowing which windows in the list are explorer windows. And even if you did, WinMove does not accept a handle as an argument.

I must be missing something important. Help!

Link to comment
Share on other sites

Welcome to the forum.

First of all, WinMove() do accept a handle, check it's page in the helpfile.

You can use _WinAPI_GetClassName() to get a class.

I checked the help file again and could not find anything about WinMove accepting a handle. However, I tried it anyway and it works! And _WinAPI_GetClassName() solves my problem. THANKS!!!

Link to comment
Share on other sites

At the end of the "title" line there is a link that says "Title special definition" which leads to the page "Window Titles and Text (Advanced)" and at the bottom of that it is explained that AutoIt has support for Window Handles / HWNDs. It's not that hard to find.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...