I want to use Alt+d to trigger Delete.
!d::Send, {delete}
This works almost everywhere except in explorer. Nothing happens when select a file and press Alt+d. Why is that?
Environment: latest AutoHotKey, Windows 10-64bit
Try
!d::
IfWinActive ahk_class CabinetWClass ; explorer
{
; The control retrieved by this command is the one that has keyboard focus
ControlGetFocus, FocusedControl, A ; A means the active window
; MsgBox %FocusedControl%
If FocusedControl contains DirectUIHWND,SysListView
SendInput, {AppsKey}d
else
Send, {delete}
}
else
Send, {delete}
return