Global Case insensitive option for SetTitleMachMode RegEx

Propose new features and changes
Haswell
Posts: 46
Joined: 21 Feb 2016, 17:11

Global Case insensitive option for SetTitleMachMode RegEx

24 May 2020, 05:08

There is a great option "SetTitleMachMode, RegEx" that makes use of Regular Expression.
Since it is case sensitive and after turning it on globally for a large script some of my hotkeys stopped working.
I don't know why but

Code: Select all

WinGet, proc, ProcessName, A
gives me "Explorer.EXE" instead of "explorer.exe" and my hotkeys stop working due to these values are not equal.

That's why I have to change this code:

Code: Select all

#IfWinActive, ahk_exe explorer.exe
to this code:

Code: Select all

#IfWinActive, ahk_exe i)explorer.exe
It's not a big deal but it would be more comfortable to set case insensitiveness globally.
swagfag
Posts: 3974
Joined: 11 Jan 2017, 17:59

Re: Global Case insensitive option for SetTitleMachMode RegEx

24 May 2020, 12:46

a regex need not be equivalent to a wintitle.

Code: Select all

#IfWinActive, ahk_exe explorer.exe
is not equivalent to

Code: Select all

#IfWinActive, ahk_exe i)explorer.exe
its equivalent is:

Code: Select all

#IfWinActive, ahk_exe i)^explorer\.exe$
with the anchors set based off of the original matchmode

ur hotkeys could have just as easily broken down if u had a wintitle like this one:

Code: Select all

#IfWinActive, [contains brackets]
and this is not something a case-sensitivity flag would patch for u(an "auto-\Q-\E-wrap" flag might, but at this point why even bother using SetTitleMatchMode RegEx)

"comfortable" in this particular case? yes. actually useful? not convinced
User avatar
nnnik
Posts: 4470
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Global Case insensitive option for SetTitleMachMode RegEx

25 May 2020, 03:22

The languages default in most areas is being case insensitive - rather than adding another global setting command it would be better to make case insensitivity the default for v2 and inverse the effect of i)
Recommends AHK Studio
Haswell
Posts: 46
Joined: 21 Feb 2016, 17:11

Re: Global Case insensitive option for SetTitleMachMode RegEx

25 May 2020, 06:03

swagfag wrote:
24 May 2020, 12:46
ur hotkeys could have just as easily broken down if u had a wintitle like this one:

Code: Select all

#IfWinActive, [contains brackets]
Yes, I completely agree with you.
I have to use global option RegEx because sometimes I really need regexp but today there is no way to use it not globally.
And for me it it easier to specify RegEx globally once and change all my hotkeys to regular expressions.

It would be a good solution to have an ability to specify RegExp for a certain command and not globally (i.e. overwriting the SetTitleMachMode option).
Something like this:

Code: Select all

#IfWinActive, ahk_class r)^Edit[0-9]++$ ahk_exe explorer.exe
#IfWinActive, ahk_exe r)^dotNetFx[0-9]++_(Client|Full)_x86_x64\.exe$
It is just an example (I know it is much easier to SetTitleMatchMode to 1 to find Edit-s but I want to show you the idea when you have ability to specify different kinds of SetTitleMatchMode within one command and overwriting global option).

It this case r) would mean a regular expression for a ahk_class-expression.
And another section ahk_exe doesn't use RegExp for explorer.exe and inherit the SetTitleMatchMode set before (as well as all other commands in the script).
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
lexikos
Posts: 7060
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Global Case insensitive option for SetTitleMachMode RegEx

26 May 2020, 06:06

It is possible for a window title or class to contain r) or anything else.

i is also used in the standard PCRE constructs (?i), (?-i) and (?i:subpattern). Inverting the effect of AutoHotkey's i) would be likely to cause headaches even if it wasn't associated with "insensitive" or "ignore case", so perhaps nnnik means to replace it with a different letter. C is used by hotstrings and Input to mean case-sensitive, but is already used for regex callouts.

A closer equivalent of the non-regex explorer.exe would be i)\\explorer\.exe$. The version with ^ will not work.
Haswell
Posts: 46
Joined: 21 Feb 2016, 17:11

Re: Global Case insensitive option for SetTitleMachMode RegEx

26 May 2020, 15:21

Based on the existing syntax of AutoHotkey language, it's hard to realease a straighforward solution of what I'm asking.
Unfortunately, there is no easy way to have RegExp for a particular part of the command. :(
Focusing our efforts on non-productive and non-creative endeavours wastes lives as surely as war.
Jacque Fresco / The best that money can't buy
lexikos
Posts: 7060
Joined: 30 Sep 2013, 04:07
GitHub: Lexikos

Re: Global Case insensitive option for SetTitleMachMode RegEx

19 Jun 2020, 18:17

nnnik wrote:
25 May 2020, 03:22
The languages default in most areas is being case insensitive - rather than adding another global setting command it would be better to make case insensitivity the default for v2
I was thinking about this and considering whether there could be a sensible letter option, when I remembered something:
Window titles are case sensitive

Return to “Wish List”

Who is online

Users browsing this forum: No registered users and 1 guest