Middle-Click in the Hamburger Menu

Features wanted...
Post Reply
kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Middle-Click in the Hamburger Menu

Post by kiwichick »

Can we please have the ability to middle-click locations in the Hamburger Menu? I use this menu so much and I forget that middle-click isn't possible. This feature would eliminate the need to open a new tab before clicking a location in the menu.
Windows 10 Pro 22H2

highend
Posts: 13333
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Middle-Click in the Hamburger Menu

Post by highend »

Just hold shift to open that item in a new tab?
One of my scripts helped you out? Please donate via Paypal

xy123
Posts: 142
Joined: 17 Sep 2017 11:46

Re: Middle-Click in the Hamburger Menu

Post by xy123 »

I would like middle click support in other menus, too: Favorite Folders menu which I get by double click on white space, Recent Locations button, are there any others.

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

highend wrote: 20 Aug 2023 08:37 Just hold shift to open that item in a new tab?
Thanks, I wouldn't have thought of trying that. However, middle-click would still be preferable. 1) It's a more 'logical' way of opening an item in a new tab. 2) Holding Shift means two hands are required to do the same thing one click of the middle mouse button does.
Windows 10 Pro 22H2

eil
Posts: 1622
Joined: 13 Jan 2011 19:44

Re: Middle-Click in the Hamburger Menu

Post by eil »

If i remember correctly there are some problems with menus(like right-click one, favmenu, script-created, etc) and determining which mouse button was used - that's why there is no scripted way to react on that too.
Dunno maybe rocket-click could work in such situations?..
Win 7 SP1 x64 100% 1366x768

admin
Site Admin
Posts: 60618
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Middle-Click in the Hamburger Menu

Post by admin »

True, Windows does not support Middle-Click on the standard menus.

xy123
Posts: 142
Joined: 17 Sep 2017 11:46

Re: Middle-Click in the Hamburger Menu

Post by xy123 »

Well time to replace standard menus with Don's menus. Just kidding, programming is hard, I tried and failed.

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

admin wrote: 21 Aug 2023 14:14 Windows does not support Middle-Click on the standard menus.
Thanks Don, I sometimes forget that Windows can affect things in XY.
Windows 10 Pro 22H2

Norn
Posts: 417
Joined: 24 Oct 2021 16:10

Re: Middle-Click in the Hamburger Menu

Post by Norn »

Using an autohotkey script seems to be the only way, passing a variable to XY.
perm $MButton = 1

Code: Select all

#HotIf WinActive("ahk_exe XYplorer.exe") && MouseIsOver("ahk_class #32768")

MouseIsOver(WinTitle) {
    MouseGetPos ,, &Win
    return WinExist(WinTitle " ahk_id " Win)
}


MButton::
{
    xyHwnd := GetXYHWND()

    if (xyHwnd)
        Send_WM_COPYDATA(xyHwnd, '::perm $MButton = 1')
	send "{LButton}"
}


GetXYHWND() {
	static xyClass := 'ahk_class ThunderRT6FormDC'

    if WinExist(xyClass) {
        for xyid in WinGetList(xyClass)
            for ctrl in WinGetControls(xyid)
                if A_Index = 10                ; The Floating Preview has only a few controls
                   return xyid
    }
}


Send_WM_COPYDATA(xyHwnd, message) {
   if !(xyHwnd)
       return

   size := StrLen(message)

   COPYDATA := Buffer(A_PtrSize * 3)
   NumPut("Ptr", 4194305, COPYDATA, 0)
   NumPut("UInt", size * 2, COPYDATA, A_PtrSize)
   NumPut("Ptr", StrPtr(message), COPYDATA, A_PtrSize * 2)

   return DllCall("User32.dll\SendMessageW", "Ptr", xyHwnd, "UInt", 74, "Ptr", 0, "Ptr", COPYDATA, "Ptr")
}
Win10, Win11 @100% 2560x1440 22H2

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

Norn wrote: 25 Aug 2023 15:31 Using an autohotkey script seems to be the only way, passing a variable to XY.
Thanks, I'll give that a go. A couple of questions:

1) Is this code for AutoHotkey v1 or v2?
2) What do I do with the perm variable?
Windows 10 Pro 22H2

klownboy
Posts: 4142
Joined: 28 Feb 2012 19:27

Re: Middle-Click in the Hamburger Menu

Post by klownboy »

Hi kiwichick. hotif is available is AHK Version 2 only so norn's script is version 2. I use the older version of AHK (many of us still do). You can get more background and examples here for using AHK to detect a right click or middle click in a XYplorer context menu viewtopic.php?t=18062. I just recently set up my BC hamburger menu to use left and right click, but you can easily use it for middle click also. I've been using it for years for detecting right clicking in other XYplorer menus. I can provide you with the code for the menu below if you want to use it as an example.

The perm is used in the XYplorer script to determine which mouse click was used. In this case the perm established in the AHK script is called $rmb. So, if $rmb is "1", one action is taken if not the other action is. The perm variable, $rmb must be cleared so it doesn't affect subsequent operations. For example:

Code: Select all

::LayCatTools                 Session Manager;/:tabsets;if($rmb=="1"){load "<xyscripts>\SessionManager.xys";} else {load "<xyscripts>\LayCatTools.xys";}unset $rmb;
Hamburger.jpg
Hamburger.jpg (58.56 KiB) Viewed 465 times
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

klownboy wrote: 26 Aug 2023 12:14 hotif is available is AHK Version 2 only so norn's script is version 2.
Thanks, I managed to figure that out.
I can provide you with the code for the menu below if you want to use it as an example.
Yes please, that would be great!
The perm is used in the XYplorer script to determine which mouse click was used.
Thanks again, I realise that but was confused as to why that particular piece of code was posted separately and whether I needed to do something with it other than it being in the script.

So, as long as I have AutoHotkey V2 installed (which I do), do I just run the script as is and the middle-click should work in the Hamburger Menu? Only asking because that's what I did but it didn't work.
Windows 10 Pro 22H2

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

kiwichick wrote: 27 Aug 2023 04:57
klownboy wrote: 26 Aug 2023 12:14 hotif is available is AHK Version 2 only so norn's script is version 2.
Thanks, I managed to figure that out.
I can provide you with the code for the menu below if you want to use it as an example.
Yes please, that would be great!
The perm is used in the XYplorer script to determine which mouse click was used.
Thanks again, I realise that but was confused as to why that particular piece of code was posted separately and whether I needed to do something with it other than it being in the script.

So, as long as I have AutoHotkey V2 installed (which I do), do I just run the script as is and the middle-click should work in the Hamburger Menu? Only asking because that's what I did but it didn't work.

EDITED TO ADD: OK so when I said it didn't work, I was wrong. It works when using middle-click on my mouse. However, I have an AutoHotkey script that uses a key on my keyboard to act as middle-click and the Hamburger Middle-Click script doesn't work when using that key.
Windows 10 Pro 22H2

klownboy
Posts: 4142
Joined: 28 Feb 2012 19:27

Re: Middle-Click in the Hamburger Menu

Post by klownboy »

You'll have to incorporate the fact that the AutoHotkey script is setting the perm variable to "1" (in norn's AHK v2 script that's that $MButton) which recognizes that a middle click was used. First, that AHK script has to be started. If it's something you want to use all the time, then it should be started when Windows starts.

I use a Visual basic file to start the AHK script when Windows boots. It does many other things along with this. The link to it in my case is in the folder/name: C:\Users\ken\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ahkVB.vbs.lnk The VB startup file, ahkVB.vbs is:

Code: Select all

Set objShell = CreateObject("WScript.Shell")
objShell.run("D:\Tools\AutoHotkey\AHKscripts\AHK_01.ahk")
That file refers to and starts the AHK file in my case that's: "D:\Tools\AutoHotkey\AHKscripts\AHK_01.ahk" Your XYplorer script has to determine if the middle mouse button was clicked by checking if the variable $MButton= "1" was set. If the variable is "1", you specify one action if it is not then specify another action. Look at my script for the examples on how to do that. In my script I'm using the perm variable $rmb whereas norn's is $MButton. That variable has to be cleared or unset after the actiion is taken so it doesn't affect subsequent actions.

I have a Logitech MX Keys keyboard which can simulate various mouse and keyboard actions. I'll have to check if I can simulate that middle click on the keyboard, but that would be independent of AHK and the XY script.

Code: Select all

      [Left]                                      [Right]
::XY Updater                        Control Panel;/D:\Graphics\Icons\xy_02.ico; if($rmb=="1") {run "%windir%\explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}";}else {update 1+16+128;}unset $rmb;
::Device Manager                 Disk Management;/<xyicons>\preferences.ico; if($rmb=="1") {open "C:\Windows\System32\diskmgmt.msc";}else {open "C:\Windows\System32\devmgmt.msc";}unset $rmb;
::Move to other pane           Copy to Pane;/:dpmoveto;if($rmb=="1") {#803;} else {#804;}unset $rmb;
::LayCatTools                         Session Manager;/:tabsets;if($rmb=="1") {load "<xyscripts>\SessionManager.xys";} else {load "<xyscripts>\LayCatTools.xys";}unset $rmb;
::Latest 30 files                     Latest 5 files;/:visualfilter; if($rmb=="1"){tab("new",'vi:<pick 5.m> //"Latest 5"');} else {tab("new",'vi:<pick 30.m> //"Latest 30"');}
::Pick Gifs                             Pick Webms;/:cfi; if($rmb=="1") {goto 'vi:<get pick |.webm "G:\PDFs and Books\Misc\tools"> //"Webm Tools"';} else {goto 'vi:<get pick |.gif "G:\PDFs and Books\Misc\tools"> //"Gif Tools"';}unset $rmb;
::Copy Path/Name                Clipboard;/:clip; if($rmb=="1") {#625;} else {#101;}unset $rmb;
-
::Modified Today                 Modified this week;/D:\Graphics\Icons\filter_01.ico;if($rmb=="1") {filter "ageM: <=7 d";}else{filter "ageM: d"}unset $rmb;
::New folder                        New file;/:newfolder;if($rmb=="1") {#234;}else{#231;}unset $rmb;
-
Toggle global filter;#387;D:\Graphics\Icons\filter_01.ico
::DoubleClick WhiteSpace Menu;/:cfi;userbutton 46;
Help scripting commands;#1459;D:\Graphics\Icons\system volume info_03.ico
ShowHelpTopics;#1460;D:\Graphics\Icons\Help.ico
Edit: Sorry I forgot the hamburger script.
Windows 11, 23H2 Build 22631.3447 at 100% 2560x1440

kiwichick
Posts: 557
Joined: 08 Aug 2012 04:14
Location: Pahiatua, New Zealand

Re: Middle-Click in the Hamburger Menu

Post by kiwichick »

klownboy wrote: 27 Aug 2023 12:30 You'll have to incorporate the fact that the AutoHotkey script is setting the perm variable to "1" (in norn's AHK v2 script that's that $MButton) which recognizes that a middle click was used. First, that AHK script has to be started. If it's something you want to use all the time, then it should be started when Windows starts.

I use a Visual basic file to start the AHK script when Windows boots. It does many other things along with this. The link to it in my case is in the folder/name: C:\Users\ken\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\ahkVB.vbs.lnk The VB startup file, ahkVB.vbs is:

Code: Select all

Set objShell = CreateObject("WScript.Shell")
objShell.run("D:\Tools\AutoHotkey\AHKscripts\AHK_01.ahk")
That file refers to and starts the AHK file in my case that's: "D:\Tools\AutoHotkey\AHKscripts\AHK_01.ahk" Your XYplorer script has to determine if the middle mouse button was clicked by checking if the variable $MButton= "1" was set. If the variable is "1", you specify one action if it is not then specify another action. Look at my script for the examples on how to do that. In my script I'm using the perm variable $rmb whereas norn's is $MButton. That variable has to be cleared or unset after the actiion is taken so it doesn't affect subsequent actions.

I have a Logitech MX Keys keyboard which can simulate various mouse and keyboard actions. I'll have to check if I can simulate that middle click on the keyboard, but that would be independent of AHK and the XY script.

Code: Select all

      [Left]                                      [Right]
::XY Updater                        Control Panel;/D:\Graphics\Icons\xy_02.ico; if($rmb=="1") {run "%windir%\explorer.exe shell:::{ED7BA470-8E54-465E-825C-99712043E01C}";}else {update 1+16+128;}unset $rmb;
::Device Manager                 Disk Management;/<xyicons>\preferences.ico; if($rmb=="1") {open "C:\Windows\System32\diskmgmt.msc";}else {open "C:\Windows\System32\devmgmt.msc";}unset $rmb;
::Move to other pane           Copy to Pane;/:dpmoveto;if($rmb=="1") {#803;} else {#804;}unset $rmb;
::LayCatTools                         Session Manager;/:tabsets;if($rmb=="1") {load "<xyscripts>\SessionManager.xys";} else {load "<xyscripts>\LayCatTools.xys";}unset $rmb;
::Latest 30 files                     Latest 5 files;/:visualfilter; if($rmb=="1"){tab("new",'vi:<pick 5.m> //"Latest 5"');} else {tab("new",'vi:<pick 30.m> //"Latest 30"');}
::Pick Gifs                             Pick Webms;/:cfi; if($rmb=="1") {goto 'vi:<get pick |.webm "G:\PDFs and Books\Misc\tools"> //"Webm Tools"';} else {goto 'vi:<get pick |.gif "G:\PDFs and Books\Misc\tools"> //"Gif Tools"';}unset $rmb;
::Copy Path/Name                Clipboard;/:clip; if($rmb=="1") {#625;} else {#101;}unset $rmb;
-
::Modified Today                 Modified this week;/D:\Graphics\Icons\filter_01.ico;if($rmb=="1") {filter "ageM: <=7 d";}else{filter "ageM: d"}unset $rmb;
::New folder                        New file;/:newfolder;if($rmb=="1") {#234;}else{#231;}unset $rmb;
-
Toggle global filter;#387;D:\Graphics\Icons\filter_01.ico
::DoubleClick WhiteSpace Menu;/:cfi;userbutton 46;
Help scripting commands;#1459;D:\Graphics\Icons\system volume info_03.ico
ShowHelpTopics;#1460;D:\Graphics\Icons\Help.ico
Edit: Sorry I forgot the hamburger script.
Thanks for all that. sorry it took me so long to reply, I've been away on holiday. Did you manage to check if you could simulate the middle-click on your keyboard?
Windows 10 Pro 22H2

Post Reply