AutoHotkey / AutoHotkeyDocs

Documentation for AutoHotkey
https://autohotkey.com/
375 stars 746 forks source link

It's not clear in the docs that ExcludeTitle doesn't work with ahk_group #671

Closed george9816 closed 11 months ago

george9816 commented 11 months ago

In WinActivate docs, for example, at [WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText], it is written:

"If each of these is blank or omitted, the Last Found Window will be used. Otherwise, specify for WinTitle a window title or other criteria to identify the target window and/or for WinText a substring from a single text element of the target window (as revealed by the included Window Spy utility). Hidden text elements are detected if DetectHiddenText has been turned on. Windows whose title or text contains ExcludeTitle or ExcludeText will not be considered"

From there one would understand that GroupAdd also works with ExcludeTitle, which would be intuitive. But it actually does not work.

So, please, somehow specify that ExcludeTitle is not working with ahk_groups. Or, even better, make it work. :D

Ragnar-F commented 11 months ago

What exactly do you mean with "ExcludeTitle doesn't work with ahk_group"? WinActivate("ahk_group VSCodeWindows",, "v2.ahk") or WinActivate("...",, "ahk_group VSCodeWindows")? The former works. The latter does not work, but is indirectly mentioned several times on the WinTitle page that ahk_ criteria can only be used in the WinTitle parameter.

george9816 commented 11 months ago

I was referring to the later example, yes.

I think it is better to be specified in the paragraph I originally quoted, because from there anyone would understand that it also works with groups.

george9816 commented 11 months ago

@Ragnar-F , you know, "indirectly mentioned" maybe is enough for someone experimented, or who already knows what is about, but not really for a newcomer. 😅

Ragnar-F commented 11 months ago

I intend to change this to the following:

If each of these is blank or omitted, the Last Found Window will be used. Otherwise, specify for WinTitle a window title or other criteria to identify the target window and/or for WinText a substring from a single text element of the target window (as revealed by the included Window Spy utility).

ExcludeTitle and ExcludeText can be used to exclude one or more windows by their title or text. Their specification is similar to WinTitle and WinText, except that ExcludeTitle does not recognize any criteria other than the window title.

Window titles and text are case-sensitive. By default, hidden windows are not detected and hidden text elements are detected, unless changed with DetectHiddenWindows and DetectHiddenText. By default, a window title can contain WinTitle or ExcludeTitle anywhere inside it to be a match, unless changed with SetTitleMatchMode.

What do you think? Is this easier to understand?

george9816 commented 11 months ago

Yeah, it's perfect now.

There is one more thing would make users life simpler, I think. Make somewhere (maybe in Remarks or Examples section) a mention that, to exclude multiple windows, SetTitleMatchMode RegEx could be used instead ahk_group. What do you think?

Ragnar-F commented 11 months ago

Thanks for your suggestions. I've added them for v1 and v2.

There is one more thing would make users life simpler, I think. Make somewhere (maybe in Remarks or Examples section) a mention that, to exclude multiple windows, SetTitleMatchMode RegEx could be used instead ahk_group. What do you think?

It is difficult to find an appropriate place for this in the docs. I decided to use the Examples section of SetTitleMatchMode, so at least we have a RegEx example.

george9816 commented 11 months ago

Thank you for your receptiveness!