0
votes

can someone help me with a simple question? I'm trying to get my IfWinExist working. I want the script below to only apply to windows with the title "Internet Download Manager", but not "Internet Download Manager - Configuration". At the moment, the script closes both of those windows.

SetTitleMatchMode 1 // have tried setting this to 3 as well but didn't work

SetTimer, CloseIDMRegistrationPopup2, 5000

CloseIDMRegistrationPopup2:
IfWinExist, Internet Download Manager
{
    Winget, annoyed, ID, Internet Download Manager
    WinActivate, ahk_id %annoyed%
    WinShow, ahk_id %annoyed%
    Sleep, 1000
    WinClose, ahk_id %annoyed%
    ;Send, {ESC}
}
return
1
Use "SetTitleMatchMode, 3" (A window's title must exactly match WinTitle to be a match) autohotkey.com/docs/commands/SetTitleMatchMode.htmJerry Jeremiah
If the window is hidden, you have to add DetectHiddenWindows, On. If the script doesn't contain any hotkeys, add #Persistent on top.user3419297

1 Answers

1
votes

According to

http://autohotkey.com/docs/commands/SetTitleMatchMode.htm

SetTitleMatchMode, MatchMode

One of the following digits or the word RegEx:

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.

So you should use:

SetTitleMatchMode, 3