Code: Select all
SetTitleMatchMode 2
if WinExist("New notification ahk_exe ShellExperienceHost.exe")
{ do something }
else MsgBox("window not found")
Code: Select all
SetTitleMatchMode 2
if WinExist("New notification ahk_exe ShellExperienceHost.exe")
{ do something }
else MsgBox("window not found")
In this particular use case, the window, or rather, toast notification, does already exist.
Value is zero if I use
Code: Select all
MsgBox(WinExist("New notification ahk_exe ShellExperienceHost.exe"))
Code: Select all
#Requires AutoHotkey v2.0
If !Instr(A_AhkPath, 'UIA') && !((cLine := DllCall('GetCommandLine', 'str')) ~= ' /restart(?!\S)')
If FileExist(ahk := A_ProgramFiles '\AutoHotkey\v2\AutoHotkey64_UIA.exe') {
Try Run ahk ' /restart ' RegExReplace(cLine, '.+\.exe.*? ')
ExitApp
} Else MsgBox 'File not found.`n`n' ahk, 'Error', 48
TrayTip 'Multiline`nText', 'My Title', 'Iconi Mute'
WinWait 'New notification ahk_exe ShellExperienceHost.exe'
MsgBox