one very straightforward way is to use your mouse to identify the right windows to name. something like this maybe. thefollowing code assumes you're not in full screen mode for any window. it uses an input box to help you id the right windows
#SingleInstance, Force
#Persistent
#MaxThreadsPerHotkey 2
SetTitleMatchMode, 2
SetBatchLines, -1
SetKeyDelay, 50,50
DetectHiddenWindows, On
CoordMode, Pixel, Screen
CoordMode, Mouse, Screen
CoordMode, Tooltip, Screen
;SendMode, Event
SetTitleMatchMode, 2
CoordMode, pixel, screen
Coordmode, mouse, screen
; Hover over one of the windows
SoundBeep, 750
tooltip, place mouse over the window you want to identify. press middle mouse button, 100, 0
; press the middle mouse button to identify that window
keywait, MButton, D
keywait, MButton
mousegetpos, w1mx, w1my, w1id
; then get the window title from the id
wingettitle, w1title, ahk_id %w1id%
msgbox,0x1020, , This window's id and title are`nId:`t%w1id%`ntitle:`t%w1title%
; with that title find all windows that match that title
WinGet, winlist, List, %w1title%
; make a displayable string showing the list of ids
str =
loop %winlist%
{ thisid := winlist%A_Index%
str = %str%`n%thisid%
}
msgbox, Number of matching windows = %winlist%%str%
; then to use any window in the list you simply activate it using it's id
;If (winlist)
;{ random, thiswin, 1, %winlist% ;<-- pick a random window from the list
; wid := winlist%thiswin%
; msgbox,0x1020,,Activating window#: %thiswin% id: %wid%
; winactivate, ahk_id %wid%
; click
;}
[color=#FF0000]str =
Loop %winlist% ;<-- used from the example i posted earlier
{ thisid := winlist%A_Index% ; gets the id
thisid = ahk_id %thisid%
winactivate, %thisid%
Inputbox, choice, ,what name do you want to give this window?
If (Errorlevel) ;<-- cancel was pressed
{ choice = NoName%A_Index%
}
%choice% = %thisid%
str = %str%name: %choice%`tid:%thisid%`n
}
msgbox,0x1020,, You chose`n`n%str%`n for your window names
ListVars ;<-- shows the list of variables in the script
pause
exitapp[/color]