Here's the code:
Code: Select all
WinGetTitle, winTitle, ahk_pid %winPID%
IfEqual winTitle, Find
{
WinGet exeName, ProcessName, ahk_pid %winPID%
IfInString exeName, TextPad
{
Debug("Before changing folder " winTitle ", " winPID)
OldMatchMode := A_TitleMatchMode
SetTitleMatchMode 2
WinGet winPID, pid, TextPad - ahk_exe Textpad.exe
WinGetTitle winTitle, ahk_pid %winPID%
SetTitleMatchMode %OldMatchMode%
}
}
Debug("Finding related to window " winTitle ", " winPID)
Code: Select all
VMandHost.ahk: Before changing title: Find, 8636
VMandHost.ahk: Finding related to window Find, 8636
The window I'm trying to replace is always named either 'Find' or 'Find in Files'
The title of the main window is always of the format 'TextPad - <PATH_TO_FILE_CURRENTLY_OPEN>'
It's my understanding that the second WinGet and WinGetTitle should be retrieving info for the main window, but it's clearly not. What am I doing wrong?