RegEx WinActive() quick help

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
robinson
Posts: 214
Joined: 12 Sep 2019, 20:28

RegEx WinActive() quick help

Post by robinson » 15 May 2024, 08:17

Hi, noob here.
Could someone just quickly write me a #HotIf WinActive()
for the RegEx "\d\d\d" ?
(i.e. only activate if the active window title contains three numbers in a row)
Can't seem to remember/think how to do it.
Thanks!

User avatar
Seven0528
Posts: 395
Joined: 23 Jan 2023, 04:52
Location: South Korea
Contact:

Re: RegEx WinActive() quick help

Post by Seven0528 » 15 May 2024, 08:36

 Not tested.

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
#HotIf HotIfCond.F2
F2::  {

}
#HotIf

class HotIfCond
{
    static F2    {
        get  {
            prevTMM := setTitleMatchMode("RegEx")
            result := winExist("\d{3}"), setTitleMatchMode(prevTMM)
            return result
        }
    }
}

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
#HotIf format("{2}", prevTMM:=setTitleMatchMode("RegEx"), winExist("\d{3}"), setTitleMatchMode(prevTMM))
F2::  {

}
#HofIf

Code: Select all

#Requires AutoHotkey v2.0
#SingleInstance Force
setTitleMatchMode("RegEx")

#HotIf winExist("\d{3}")
F2::  {

}
#HotIf
  • English is not my native language. Please forgive any awkward expressions.
  • 영어는 제 모국어가 아닙니다. 어색한 표현이 있어도 양해해 주세요.

Post Reply

Return to “Ask for Help (v2)”