Getting Window Name

Started by bettman, February 17, 2016, 10:07:55 AM

Previous topic - Next topic

bettman

Greetings,

I have a need to determine the text in the title bar of an application window in order to maximize it. I know the name of the exe which spawns the window but the text in the title bar is dynamic. Is there a way, based upon the name of an exe, to get the title bar text of a window spawned by the exe?

Thank you.

td

In most instances you can use the Control Manager extender's cWndByWndSpec function since it doesn't rely on the windows name.   The Roboscripter utility which can be found in the WinBatch folder of your start menu can be used to create the window specification the function needs.   The specification is usually all you need but sometimes it is necessary to modify it a bit because the Window has dynamically created controls or style name.   

If cWndByWndSpec doesn't do the job for you things can get a bit more complicated so I would try that first.   You can find more information about the cWndByWndSpec function and Roboscripter in the Consolidated WIL Help file.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

bettman

If I understand how the function works, it appears that I need to have a partial Window name to start with (paramter 1)?

td

You do not need a 'window name' to use cWndByWndSpec.  You need the name of the window's class.  A window class name is not a 'window name' and is not the text displayed by a window title bar.   RoboScripter can identify the class name for you or you can use the analysis script in your WinBatch samples directory to obtain a window's class name.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

You can also use the cWndGetWndSpec function to create a windows 'specification' from an existing window.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

td

Also neglected to mention Partial Window Names.  You can use a Partial Window Name, if your application retains a part of its title bar text even though most of it changes.  Type Partial Window Names in the index tab edit box of the Consolidated WIL Help file to get detailed information on using Partial Window Names.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade