AutoHotkey: Backspace In Drive Root Opens My Computer: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(modified to work correctly from within archives in root) |
||
Line 20: | Line 20: | ||
;! \brief pressing BackSpace in drive root should land in My Computer | ;! \brief pressing BackSpace in drive root should land in My Computer | ||
; | ; | ||
; Assumes that the | ; Assumes that the panel title-paths are accessible (TMyPanel5/TMyPanel9), | ||
; and that BackSpace is used for cm_GoToParent (going up to the parent dir) | ; and that BackSpace is used for cm_GoToParent (going up to the parent dir) | ||
; | ; | ||
Line 28: | Line 28: | ||
$BS:: | $BS:: | ||
ControlGetFocus, tcFocus | ControlGetFocus, tcFocus | ||
ControlGetText, | ControlGetText, tcStatus1, TMyPanel9 | ||
ControlGetText, tcStatus2, TMyPanel5 | |||
SendInput, {BS} | |||
; only when the actual TC panels are active | ; only when the actual TC panels are active | ||
If( RegExMatch( tcFocus, "^ | If( RegExMatch( tcFocus, "^TMyListBox1$" ) ) | ||
tcStatus := tcStatus1 | |||
If( RegExMatch( tcStatus, "^.:\\ | Else | ||
If( RegExMatch( tcFocus, "^TMyListBox2$" ) ) | |||
tcStatus := tcStatus2 | |||
Else | |||
Return | |||
If( RegExMatch( tcStatus, "^.:\\\*\.\*$" ) ) | |||
PostMessage, 1075, 2122 ; cm_OpenDrives | |||
Return | Return | ||
Revision as of 10:37, 6 September 2007
Usually pressing Backspace in drive root does nothing, this is to prevent landing in My Computer by mistake, when holding down the key too long. Some people may prefer to reach the highest hierarchy level instead.
$BS:: IfWinActive, ahk_class TTOTAL_CMD { WinGetText, PanelText, A IfInString, PanelText, :\> PostMessage 1075, 2122, , , ahk_class TTOTAL_CMD Else Send, {BS} } Else Send, {BS} Return
Here's a variant by ND, which ensures that the script is only launched in TC and when one of the TC panels is active (tested in TC 5.50 and TC 7.01 on WinXP SP2)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;! \brief pressing BackSpace in drive root should land in My Computer ; ; Assumes that the panel title-paths are accessible (TMyPanel5/TMyPanel9), ; and that BackSpace is used for cm_GoToParent (going up to the parent dir) ; ; Sends the cm_OpenDrives command when in a drive root ; #IfWinActive, ahk_class TTOTAL_CMD $BS:: ControlGetFocus, tcFocus ControlGetText, tcStatus1, TMyPanel9 ControlGetText, tcStatus2, TMyPanel5 SendInput, {BS} ; only when the actual TC panels are active If( RegExMatch( tcFocus, "^TMyListBox1$" ) ) tcStatus := tcStatus1 Else If( RegExMatch( tcFocus, "^TMyListBox2$" ) ) tcStatus := tcStatus2 Else Return If( RegExMatch( tcStatus, "^.:\\\*\.\*$" ) ) PostMessage, 1075, 2122 ; cm_OpenDrives Return
Back to AutoHotkey