2

How can I copy the full text of a Windows program's titlebar, the actual letters not just a screenshot, to then paste into e.g. Notepad? In this example, I'd like to get the literal text

screenshot.png - IrfanView (Zoom: 1674 x 1046) (Selection: 811, 212; 2137 x 1312; 1.629)

Saving the text to a hardcoded filename or someplace else is fine, too. I just want to avoid manually reading it and typing it, which is slow and error-prone.

example

3
  • 1
    Although it is not what you are asking, you have skills.. I would suggest writing this. It wouldn't be difficult especially if it is for your own sole purpose using IrfanView. EnumWindows(), GetWindowText(), write to the windows clipboard, open the notepad, SetWindowText() on the text control.. or even open a text file and dump. Commented Jul 7, 2022 at 22:13
  • @John answer is better than my suggestion. I wasn't aware of said already written app. Commented Jul 7, 2022 at 22:15
  • @SeñorCMasMas In these modern times I'd trust my own C++ more than a closed-source utility. But it's only been a few minutes so far, let's see what else turns up. Commented Jul 7, 2022 at 22:17

3 Answers 3

1

One can use AutoHotkey to copy a window's titlebar's text to the clipboard. It provides the function WinGetActiveTitle, which may be used as follows:

#z::
WinGetActiveTitle, Title
Clipboard := Title
return
2
1

There is not any native way to copy text from the Windows title bar. True in Windows 11 and 10 and as far back as I know.

I suggest you try this third party program (there may be others):

Copy title bar text

Copy text from titlebars and elsewere in open windows easily, with GetWindowText

This free, portable and light program lets you copy text from places where normally you are unable to copy, such as title bars, status bars, toolbars, etc.

The program features a crosshair you can drag and put above the element you need to copy. As this crosshair floats above open windows it is immediately updated showing text that can be copied. Releasing the crosshair stops this procedure and you are able to copy any text current displayed on the program’s panel.

1

I use the following voice command by PGilm in Dragon Professional Individual to copy a window's titlebar's text to the clipboard:

'
'   get window title
'
Sub Main
    Clipboard ( GetWindowTitle )
End Sub
'
'   Use these Windows Functions for Getting an active Window title
'
Declare Function GetForegroundWindow Lib "user32" () As Long
'
Declare Function GetWindowText Lib "user32" _
    Alias "GetWindowTextA" ( ByVal hwnd As Long , _
        ByVal lpString As String , ByVal cch As Long ) As Long
'
'   GetWindowTitle
'   (Gets an active Window title)
'
Function GetWindowTitle() As String
    Dim x As Integer
    Dim TitleText As String * 300
    Dim hw As Long
    hw = GetForegroundWindow()
    x = GetWindowText ( hw , TitleText , Len ( TitleText ) )
    GetWindowTitle = Trim ( Left ( TitleText , x ) )
End Function
'

enter image description here

Tested with Dragon NaturallySpeaking 12.5 professional on Windows 7 SP1 x64 Ultimate and Dragon Professional Individual 15.6 on Windows 10 Pro.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .