aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-12-26 15:38:23 +0100
committerJohn Ankarström <john@ankarstrom.se>2020-12-26 15:38:23 +0100
commit8819fddff54d549fe56577c9ae92bd8a57d7beaa (patch)
tree0c0a2188acaed33e3b180ca4d2c50bea58e58c62
parentcb5563276258bb78741461e5f24bd24125576256 (diff)
downloadahk-8819fddff54d549fe56577c9ae92bd8a57d7beaa.tar.gz
doubleclick, explorer: Simplify DoubleClick function
Also invoke Edit2 action when Shift is held.
-rw-r--r--tt.doubleclick.ahk16
-rw-r--r--tt.programs.explorer.ahk17
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