This is what I have so far.
Code: Select all
#NoEnv
SetBatchLines -1
DllCall("QueryPerformanceFrequency", "Int64*", freq)
GroupCreate("ExplorerUI", "ahk_class Shell_TrayWnd", "ahk_class WorkerW", "ahk_class DV2ControlHost", "ahk_class NotifyIconOverflowWindow")
Loop {
KeyWait RWin, D
DllCall("QueryPerformanceCounter", "Int64*", RWinP)
KeyWait RWin
} return
#If qpc() - RWinP << 1 <= freq and A_PriorKey == "RWin" and WinActive(,, "ahk_group ExplorerUI")
RWin Up:: PostMessage 0x112, 0xF020 ; Minimize the active window
>^RWin Up:: GetKeyState("RCtrl", "P") and WinClose() ; Close the active window
#If
GroupCreate(GroupName, Rules*) {
For Index, Rule in Rules
GroupAdd % GroupName, % Rule
}
qpc() {
DllCall("QueryPerformanceCounter", "Int64*", p)
return p
}
WinClose(WinTitle := "", WinText := "", ExcludeTitle := "", ExcludeText := "") {
PostMessage 0x112, 0xF060,,, % WinTitle, % WinText, % ExcludeTitle, % ExcludeText
return ErrorLevel
}