From 8819fddff54d549fe56577c9ae92bd8a57d7beaa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 26 Dec 2020 15:38:23 +0100 Subject: doubleclick, explorer: Simplify DoubleClick function Also invoke Edit2 action when Shift is held. --- tt.doubleclick.ahk | 16 ++-------------- tt.programs.explorer.ahk | 17 ++++++++++------- 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/tt.doubleclick.ahk b/tt.doubleclick.ahk index 58d83f4..bb84977 100644 --- a/tt.doubleclick.ahk +++ b/tt.doubleclick.ahk @@ -1,9 +1,7 @@ ;; DoubleClick function ;; ============================================================================ -;; DoubleClick returns true if a double click has been performed. The first -;; click in the double click is allowed to pass through, but the second click -;; is prevented. +;; DoubleClick returns true if a double click has been performed. ;; To use the function, call it whenever the user clicks. The function returns ;; true if two calls in a row meet the requirements for a double click. @@ -11,9 +9,7 @@ ;; Function definition -> library ;; ---------------------------------------------------------------------------- -;; The 'alternate' argument, if set to true, signifies a right click: - -DoubleClick(alternate := false) +DoubleClick() { ;; A bunch of global variables are needed to determine whether a double click @@ -55,10 +51,6 @@ DoubleClickClicked := false if (not DoubleClickClicked) { - if (alternate) - SendInput, {Click, right} - else - SendInput, {Click} DoubleClickPriorX := x DoubleClickPriorY := y DoubleClickLast := A_TickCount @@ -75,10 +67,6 @@ DoubleClickClicked := false || abs(x - DoubleClickPriorX) > SM_CXDOUBLECLK || abs(y - DoubleClickPriorY) > SM_CYDOUBLECLK) { - if (alternate) - SendInput, {Click, right} - else - SendInput, {Click} DoubleClickPriorX := x DoubleClickPriorY := y DoubleClickLast := A_TickCount diff --git a/tt.programs.explorer.ahk b/tt.programs.explorer.ahk index 7012451..20296c3 100644 --- a/tt.programs.explorer.ahk +++ b/tt.programs.explorer.ahk @@ -67,26 +67,29 @@ return #IfWinActive -LWin & LButton:: +*#LButton:: MouseGetPos,,, hwnd DllCall("SetForegroundWindow", "UInt", hwnd) -if (not DoubleClick()) ; see tt.doubleclick.ahk - return -if (not WinActive("ahk_group Explorer")) +if (not DoubleClick() or not WinActive("ahk_group Explorer")) ; see tt.doubleclick.ahk { SendInput, {Click} return } + ; fall through to next hotkey #IfWinActive ahk_group Explorer -#NumPadEnter:: -#Enter:: +*#NumPadEnter:: +*#Enter:: i := Explorer().Document.FocusedItem if (i.IsFolder) return -ShellApp.ShellExecute(i.path, "", "", "Edit", 1) +if (GetKeyState("Shift")) + ShellApp.ShellExecute(i.path, "", "", "Edit2", 1) +else + ShellApp.ShellExecute(i.path, "", "", "Edit", 1) +return return ; Directory navigation -- cgit v1.2.3