 |
|
| View previous topic :: View next topic |
| Author |
Message |
snakebyte Gold Member


Joined: 07 May 2003 Posts: 379 Location: Seattle
|
Posted: Sat Jan 07, 2006 5:41 am Post subject: xplorer2 HACK : Convert any menu item to a toolbar button !! |
|
|
A favorite of folks who want to add functions to their toolbar(s) as buttons.
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.exe to 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: |
Name: List
Description: >"C:\My Downloads\MenuHack.exe" 32782 |
| Code: | Name: Detail
Description: >"C:\My Downloads\MenuHack.exe" 32783 |
Note: Don't skip ">" symbol at start of your description.
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/downloads/Menu_Commands.txt
http://hacks.anunay.com/xplorer2/downloads/Hotkeys.txt
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: |
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
|
Usage Instructions
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: |
>"D:\My Scripts\MenuHack.exe" 32783
|
The last parameter passed to script is the menuid to switch the current pane to detail view. You can download the complete menu ids list from here.
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: |
#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
|
Once xplorer2 gets the ability of customizing individual user command icons, you'll be able to change icon of any existing toolbar button by creating its user command equivalent and giving it a custom icon.
[ A favorite topic: moved from x² Pro forum -fg- ] _________________ Help! I'm an AI running around in someone's universe simulator.
Last edited by snakebyte on Sat Jul 22, 2006 12:24 am; edited 6 times in total |
|
| Back to top |
|
 |
Gandolf Silver Member

Joined: 12 Jun 2004 Posts: 307
|
Posted: Sat Jan 07, 2006 12:54 pm Post subject: |
|
|
| Looks excellent, I'll have to see if it needs modifying for AutoHotkey. |
|
| Back to top |
|
 |
JamieG Member


Joined: 03 Oct 2004 Posts: 47 Location: Paris, France
|
Posted: Fri Apr 14, 2006 1:18 pm Post subject: Quick switching between pane views & Hackmenu.exe |
|
|
I've just gotten around to trying the 'Hackmenu.exe' solution and it's just perfect!
I've gotten the little hammer icons for my new "List", "Detail" & "Thumbnail" view commands and have assigned sortcut keys to them... just what I wanted. Thanks so much to Snakebyte and to Demetris for their time and their help!
PS: I'm replying here so that Snakebyte's nifty instructions will be brought back to life. |
|
| Back to top |
|
 |
JamieG Member


Joined: 03 Oct 2004 Posts: 47 Location: Paris, France
|
Posted: Sat Apr 15, 2006 7:20 am Post subject: Convert menu items to toolbar icons... not for scrap windows |
|
|
Well, nearly perfect.
It doesn't work on scrap panes, which are actually where I most often do things like changing views.
Resolving to be less of a wimp, here amongst the various Masters of the Universe, I thought I'd have a try at finding the solution myself! Hah hah! So, imagining that there were hitherto-undisclosed menu IDs to be discovered, I downloaded Wininspector, figured out enough of its interface to locate the scrap window & the magic menu number and... aargghhh! It's the same value as for the main xplorer2 window! (I suppose that shouldn't be a surprise )
So I guess I'll just have to way for a rainy day, or two, or forty for a solution. Thanks again nonetheless, Snakebyte! |
|
| Back to top |
|
 |
nikos Moderator


Joined: 07 Feb 2002 Posts: 12346 Location: UK
|
Posted: Sat Apr 15, 2006 9:00 am Post subject: |
|
|
narayan don't you think this patch is worthy of mentioning in the manual? many people seem to find it useful
snakebyte i guess you search for the window by class/title and send messages, so a slight modification should work for scraps too (with an optional command line switch). Of course the problem is that there may be many scraps open -- this also holds for the main window but for scraps it is even more likely |
|
| Back to top |
|
 |
narayan Gold Member

Joined: 04 Jun 2002 Posts: 3261
|
Posted: Sat Apr 15, 2006 9:33 am Post subject: |
|
|
| Sure! Next version of User Manual will have it! |
|
| Back to top |
|
 |
JamieG Member


Joined: 03 Oct 2004 Posts: 47 Location: Paris, France
|
Posted: Sat Apr 15, 2006 11:35 am Post subject: Great idea |
|
|
Fine idea, incorporating the Snake Byte Patch into the manual.
It'd also be nice if someone could find the time to figure out how, and then modify MenuHack.exe, so that it would work on the top-most xplorer2 window... that way I think it would work for panes too! (Would one ever want to issue a command to an inactive window?) |
|
| Back to top |
|
 |
snakebyte Gold Member


Joined: 07 May 2003 Posts: 379 Location: Seattle
|
Posted: Sun Apr 16, 2006 2:47 am Post subject: |
|
|
I never tested menuhack on the scrap panes. Here is the updated script. Menuhack now works on the topmost Xplorer2 or topmost scrap pane window.
| Code: |
if $CmdLine[0] > 0 then
$param = $CmdLine[1];
$WM_COMMAND = 0x0111
$handle = FindTopmostXplorer2Window()
DllCall("user32.dll", "int", "SendMessage", _
"hwnd", $handle, _
"int", $WM_COMMAND, _
"long", $param, _
"long", 0)
else
MsgBox(4096,"Missing Parameter","Usage: MenuHack.exe <Menu ID>")
endif
Func FindTopmostXplorer2Window()
;Get list of all the windows
$var = WinList()
;Return topmost xplorer2 or scrap window handle
For $i = 1 to $var[0][0]
If StringInStr($var[$i][0],"xplorer")>0 Or _
StringInStr($var[$i][0],"scrap")>0 Then
Return $var[$i][1]
EndIf
Next
;default return value
Return WinGetHandle( "xplorer" )
EndFunc
|
You can download the compiled version of above script from here. The usage instruction stays the same. _________________ Help! I'm an AI running around in someone's universe simulator.
Last edited by snakebyte on Sun Apr 27, 2008 12:10 am; edited 1 time in total |
|
| Back to top |
|
 |
JamieG Member


Joined: 03 Oct 2004 Posts: 47 Location: Paris, France
|
Posted: Mon Apr 17, 2006 8:05 am Post subject: Link to wrong version of MenuHack.exe |
|
|
Hi Snakebyte. Thanks for the update. You are wonderful! The link to the compiled program, however, points at the previous version, not the new one  |
|
| Back to top |
|
 |
snakebyte Gold Member


Joined: 07 May 2003 Posts: 379 Location: Seattle
|
Posted: Mon Apr 17, 2006 11:12 am Post subject: |
|
|
Hi Jamie,
Its the new version. I think your browser is reading this file from your cache. Try clearing your cache or try some other browser. If it still doesn't works, I'll upload it to a different location. _________________ Help! I'm an AI running around in someone's universe simulator. |
|
| Back to top |
|
 |
narayan Gold Member

Joined: 04 Jun 2002 Posts: 3261
|
Posted: Mon Apr 17, 2006 11:45 am Post subject: |
|
|
| I didn't have any problems getting the new version. |
|
| Back to top |
|
 |
JamieG Member


Joined: 03 Oct 2004 Posts: 47 Location: Paris, France
|
Posted: Mon Apr 17, 2006 2:50 pm Post subject: Ooops |
|
|
Thanks, Snakebyte, you were right... ah, the little embarrassments , I should have thought of that.
I cleared my cache, downloaded the new version, and it works beautifully on whichever x2 window I want... scraps & main dual-pane windows. I couldn't be happier, thanks to you!  |
|
| Back to top |
|
 |
narayan Gold Member

Joined: 04 Jun 2002 Posts: 3261
|
Posted: Tue Apr 25, 2006 9:59 am Post subject: |
|
|
snakebyte, I have sent you a PM. Please reply offline (PM or email).
Thanks! |
|
| Back to top |
|
 |
snakebyte Gold Member


Joined: 07 May 2003 Posts: 379 Location: Seattle
|
Posted: Thu Apr 27, 2006 5:12 pm Post subject: |
|
|
I found that apart from menus, MenuHack also supports xplorer2 keyboard hotkeys which are not available on xplorer2 menus. eg Ctrl+E, Ctrl+Alt+Left/Right, Ctrl+Shift+Up/Down etc.
Now you can add your favorite hotkey to toolbar as well. Download complete list of hotkey and command id mapping from here. _________________ Help! I'm an AI running around in someone's universe simulator. |
|
| Back to top |
|
 |
WimdeLange Silver Member


Joined: 16 Aug 2004 Posts: 302 Location: NL
|
Posted: Fri Apr 28, 2006 2:18 am Post subject: |
|
|
| snakebyte wrote: | | Now you can add your favorite hotkey to toolbar as well. Download complete list of hotkey and command id mapping from here. |
The link is not working. Can you place the list in ascii in the forum? (or is that not allowed? Nah , should be no problem. Debug info is placed often and never seen any complains). _________________ Groetjes,
Wim de Lange |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|