Thanks for your help!
This approach is truly elegant and doesn’t require modifying the shell menu.
How can the following code be made compatible with selecting the folders on the desktop?
How can the menu be displayed as close as possible to the mouse cursor (next to the original right-click menu)?
In many cases, the new menu appears on the left side of the original right-click menu, far away from the mouse cursor and requiring extra mouse movement, as shown in the image below.
https://i.ibb.co/TxDVS3G6/pic.png
This approach is truly elegant and doesn’t require modifying the shell menu.
How can the following code be made compatible with selecting the folders on the desktop?
// class "Window triggers.cs"
using Au.Triggers;
partial class Program
{
[Triggers]
void WindowTriggers()
{
Triggers.Options.ThreadNew();
if (true)
{
Triggers.Window[TWEvent.Visible, "", "#32768", "explorer.exe"] = t =>
{
if (wnd.findAll("", "#32768", "explorer.exe").Length > 1) return; //submenu
var m = new popupMenu("d914e490-6ce6-4319-b979-cf0de0322f43");
var wExplorer = wnd.active;
if (ExplorerFolder.Of(wExplorer) is { } e && e.GetSelectedItems() is { Length: 2 } sel && filesystem.exists(sel[0]).Directory && filesystem.exists(sel[1]).Directory)
{
m["2 folders"] = o =>
{
keys.send("Esc"); //close the Explorer's menu
script.run("2 folders", sel[0], sel[1]);
};
}
if (!m.Items.Any()) return;
var wMenu = t.Window;
m.Show(PMFlags.AlignRight, excludeRect: wMenu.Rect, owner: wMenu);
};
}
}
}How can the menu be displayed as close as possible to the mouse cursor (next to the original right-click menu)?
In many cases, the new menu appears on the left side of the original right-click menu, far away from the mouse cursor and requiring extra mouse movement, as shown in the image below.
https://i.ibb.co/TxDVS3G6/pic.png
