1
votes

I opened a window whose part of title is a.txt and I use AutoHotKey to find it.

WinGet, p_txt, ProcessName, txt
WinGet, p_atxt, ProcessName, a.txt
ListVars

It shows when search criteria is txt, p_txt has no value; when criteria is a.txt, p_atxt has value.enter image description here

Why can WinGet, p_atxt, ProcessName, a.txt find my window but WinGet, p_txt, ProcessName, txt cannot?

1

1 Answers

1
votes

The matching behavior if window titles is determined by SetTitleMatchMode.

Amongst others, there are these modes:

1: A window's title must start with the specified WinTitle to be a match.
2: A window's title can contain WinTitle anywhere inside it to be a match.
3: A window's title must exactly match WinTitle to be a match.

SetTitleMatchMode, 2 is what you're looking for.