-
-
Save roryokane/6346782 to your computer and use it in GitHub Desktop.
; how to write scripts: http://www.autohotkey.com/docs/ | |
#IfWinActive ahk_class CabinetWClass ; File Explorer | |
^Backspace:: | |
#IfWinActive ahk_class Notepad | |
^Backspace:: | |
Send ^+{Left}{Backspace} | |
#IfWinActive | |
; source and context: http://superuser.com/a/636973/124606 | |
; relevant documentation links: | |
; writing hotkeys | |
; http://www.autohotkey.com/docs/Hotkeys.htm | |
; list of key codes (including Backspace) | |
; http://www.autohotkey.com/docs/KeyList.htm | |
; the #IfWinActive directive | |
; http://www.autohotkey.com/docs/commands/_IfWinActive.htm | |
; the Send command | |
; http://www.autohotkey.com/docs/commands/Send.htm |
Why not just match the exe instead of class with ahk_exe explorer.exe
for both file explorer and windows desktop? This catches both of them.
#NoEnv
#SingleInstance force
SendMode Input
#IfWinActive ahk_class Notepad ahk_exe notepad.exe
^BS:: send ^+{left}{del}
#IfWinActive ahk_exe explorer.exe
^BS::
Also, is it really necessary to turn off context sensitivity? Line 8 that is. The script ends after that anyway.
Why not just match the exe instead of class with
ahk_exe explorer.exe
for both file explorer and windows desktop? This catches both of them.
You're right. This can be done in three lines. Also, Notepad.exe now supports word deletion.
#IfWinActive ahk_class CabinetWClass
^Backspace::Send ^+{Left}{Backspace}
#IfWinActive
We can use this instead, right?
I don't think we could use CabinetWClass for everything. As this post says, some windows are classified with ExplorerWClass (mainly the ones with the explorer navigation panel open)
@lihuelworks What update to the script are you suggesting?
I am runnnig the script but nothing is happening.
I've updated this for AHK v2
; Ctrl + Backspace works in File Explorer and Desktop
#HotIf WinActive("ahk_exe explorer.exe")
^BS::Send("^+{Left}{Del}")
#HotIf
This seems to work fine for now
I've updated this for AHK v2
; Ctrl + Backspace works in File Explorer and Desktop #HotIf WinActive("ahk_exe explorer.exe") ^BS::Send("^+{Left}{Del}")
This seems to work fine for now
Can't react but works like a charm, thank you 🙌🏻🙌🏻
Syntax for Autohotkey v2
#HotIf WinActive("ahk_exe explorer.exe")
^BS::Send("^+{Left}{Del}")
#HotIf
This should be added after line 4 to add support for the windows desktop: