This topic thread was originally posted in the xplorer² Professional forum. Moved here 19-May-2010 =fg=
============================================================
UPDATED: Simplified usage instructions.
MenuHack.exe will let you add any Xplorer2 menu item or Xplorer2 Hotkey to your toolbar. This example shows how to add list and detail pane style options to your toolbar.
1. Download MenuHack.exeto some folder (say C:\My Downloads)
2. Create two new user command in Xplorer2 (Go to Customize->User commands ->Add new). Fill out Name and Description as shown below.
Code: Select all
Name: List
Description: >"C:\My Downloads\MenuHack.exe" 32782
Code: Select all
Name: Detail
Description: >"C:\My Downloads\MenuHack.exe" 32783
3. Add these two commands to your toolbar (Right click on your toolbar and choose customize. Add "List" and "Detail" commands that you created earlier from left list box to the right one).
4. Now you can use these two toolbar buttons to switch between list and detail views.
Download following menu id and hotkey list to add any other command to your toolbar
http://hacks.anunay.com/xplorer2/downlo ... mmands.txt
http://hacks.anunay.com/xplorer2/downloads/Hotkeys.txt
Update v1.2
Kilmatead cleaned up and updated the original menuhack code to work with x2 v2.0. You can download the updated version here.
Thanks Kilmatead
Update v1.1
Menuhack can now simulate Ctrl, Alt or Shift key down during any X2 command execution.
Here are few examples
Copy with confirmation dialog
>"C:\Tools\MenuHack.exe" 32793
Copy without confirmation
>"C:\Tools\MenuHack.exe" 32793 CTRL
Open new Tab in Current pane
>"C:\Tools\MenuHack.exe" 33036
Open new Tab in Opposite pane
>"C:\Tools\MenuHackv1.1.exe" 33036 ALT
Original Post
I think some of the cool xplorer2 functionality is hidden in deep menus and is not being used to its full extent due to following reasons:
a) Only menu entry exists. No toolbar icon or hotkey is available. Multiple clicks are required to get the desired result. (E.g. Duplicate, list, detail, thumbnail etc).
b) Hotkey is available, but there is no equivalent toolbar button. It's often difficult to remember hot keys for all your favorite actions. I often get confused with these ones: Alt+H, Ctrl+H, Alt+J, Ctrl+Alt+M, Ctrl+Alt+J. Also when you are holding mouse, its bit inconvenient to leave it and press something on keyboard especially when it requires both hands.
I believe there is a limitation in xplorer2 where you can only create toolbar items for items having icons. Lately, I have been seeing lot of requests in Xplorer2 forum to add extra tool bar buttons and I decided to share this hack which I've been using for over a year now.
This hack will let you map *any* menu item to a toolbar button. First let me explain how it works. When user selects an item from menu, WM_COMMAND message is sent to the OS. This message is passed with two parameters wParam and lParam. These parameters contain numeric code that tells OS which menu item was selected. Each menu item is associated with a unique code. It is possible to simulate a menu click by passing a WM_COMMAND message with appropriate menu code.
So how can you find out these codes? Well there are two ways to do it. 1) Use tools like Spy++ or Winspector to spy the windows messages from Xplorer2, or 2) The most easiest way is to use resource hacker to extract complete menu dump in one go.
Following AutoIt3 script accepts menu code as parameter and simulates a menu click
Code: Select all
if $CmdLine[0] > 0 then
$param = $CmdLine[1];
$WM_COMMAND = 0x0111
$WindowTitle = "xplorer"
DllCall("user32.dll", "int", "SendMessage", _
"hwnd", WinGetHandle( $WindowTitle ), _
"int", $WM_COMMAND, _
"long", $param, _
"long", 0)
else
MsgBox(4096,"Missing Parameter","Usage: MenuHack.exe <Menu ID>")
endif
If you don't want to install AutoIt3 you can download the compiled version of this script from this link here and execute it as
Code: Select all
>"D:\My Scripts\MenuHack.exe" 32783
Some of my favorite commands are: (Note: Create top two ones first and add them to your toolbar. It will speed up your subsequent command creation)
Code: Select all
#Add New Command
>"D:\My Scripts\MenuHack.exe" 33001
#Organize Command
>"D:\My Scripts\MenuHack.exe" 33002
#List View
>"D:\My Scripts\MenuHack.exe" 32782
#Detail View
>"D:\My Scripts\MenuHack.exe" 32783
[ A favorite topic: moved from x² Pro forum -fg- ]