Page 1 of 1
Help with context menu
Posted: 10 Dec 2011 10:33
by Bashis
Hi.
I have developed about 6 scripts in batch. They already work and what i want is create a cascade menu like winrar in context menu to execute them in that way (right click mouse).
I was able to add 6 context entries one for each script but i'd like to integrate all of them in a cascade context menu.
I have search and it seems that i need to use a .dll or something like that. Im very newbie in windows (usually i develop scripts in linux).
Can someone guide me a little please?
Thx and excuse my english.
Re: Help with context menu
Posted: 10 Dec 2011 10:52
by aGerman
That's not a Batch related issue. All I know is that there are a couple of registry entries, such like ...
HKEY_CLASSES_ROOT\*\shell
HKEY_CLASSES_ROOT\*\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\AllFileSystemObjects\shell
HKEY_CLASSES_ROOT\AllFileSystemObjects\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\Folder\shell
HKEY_CLASSES_ROOT\Folder\shellex\ContextMenuHandlers
HKEY_CLASSES_ROOT\Directory\shell
I'm afraid I can't help with more information.
Regards
aGerman
Re: Help with context menu
Posted: 10 Dec 2011 10:56
by Bashis
Thx mate.
I have searched a lot of info. And i was able to add 6 entries to context menu and they work. But what i want is something like winrar context menu (a cascade with my 6 scripts).
Re: Help with context menu
Posted: 10 Dec 2011 11:17
by orange_batch
It requires a context menu handler, which is a C++ programmed DLL. I've looked into it extensively myself, it only confused the heck out of me why it's so complex. It's beyond my capability.
There's only 3 things you can do currently:
1. Keep it as-is, the 6 menu items (non-cascade).
2. Put shortcuts to them in SendTo. Allows better customization and sending of multiple files/folders to a single script in multiple arguments.
3. Build a script that's a menu itself for the 6(+) other scripts, and have 1 item on the context menu for it.
Re: Help with context menu
Posted: 10 Dec 2011 11:56
by Bashis
orange_batch wrote:It requires a context menu handler, which is a C++ programmed DLL. I've looked into it extensively myself, it only confused the heck out of me why it's so complex. It's beyond my capability.
There's only 3 things you can do currently:
1. Keep it as-is, the 6 menu items (non-cascade).
2. Put shortcuts to them in SendTo. Allows better customization and sending of multiple files/folders to a single script in multiple arguments.
3. Build a script that's a menu itself for the 6(+) other scripts, and have 1 item on the context menu for it.
UOU mate. You are awesome!!. Im reached this steps and after hours looking for solve problem i posted here cause i cant figure out it was so complex (now i see it is).
I dont know nothing about DLL. Would be difficult use someone dll to integrate cascade context? Can someone post me some how to or some guide?
Im thinking of release a beta with the 6 context menu and fix this later. I thought about SendTo but it result some of those scripts get data from FTP xD and could be confusing.
Thx and excuse my english.
Re: Help with context menu
Posted: 12 Dec 2011 14:17
by colargol
Hello
I'm using
KuShellExtension for this. It's a C++ dll. Very easy to use.
Can be used with batch also; it's very useful for working with files.
(note: if you want to use it with more than one program, you will have to define different CLSID in the config file)
Re: Help with context menu
Posted: 12 Dec 2011 14:22
by orange_batch
Nice, thanks! This is perfect!
I experimented with it a bit, so to help you out Bashis, here's a quick guide for what you want to do:
1. Download
7-zip if you don't already have it (required). http://www.7-zip.org
2.
Download KuShellExtension here.3. Right click
KuShellExtension-0.04.7z and select
7-zip: Extract to "KuShellExtension-0.04.7z\".
4. Rename the folder if you want, and place it where you want
KuShellExtension to be installed, such as Program Files.
5.
This URL will explain how to write the
config.xml file for
KuShellExtension.
6. It's easy once you get the idea! I suggest using
' ' instead of
" " for attributes, so you can use
" " instead of
" for command lines. Here's my quick sample
config.xml:
Code: Select all
<?xml version='1.0' encoding='UTF-8'?>
<config version='1'>
<var name='LEGACY_STYLE'>false</var>
<var name='HIDE_MISSING'>false</var>
<menuitem name='Open in Command Prompt' class='folder'>"${env:comspec}" /k cd /d "%1"</menuitem>
<menuitem name='Send all to My Batch' icon='path to icon/exe file' class='* directory'>"path to batch" %*</menuitem>
<!-- Cascading menu with X number of items... -->
<menu name='My Batch Menu 1' icon='Path to Icon/Exe File' class='* folder'>
<for
names='
"Item 1"
"Item 2"
"Item 3"
"Item 4"
"Item 5"
"Item 6"
'
paths='
"Path to Batch 1"
"Path to Batch 2"
"Path to Batch 3"
"Path to Batch 4"
"Path to Batch 5"
"Path to Batch 6"
'
icons='
"Path to Icon/Exe 1"
"Path to Icon/Exe 2"
"Path to Icon/Exe 3"
"Path to Icon/Exe 4"
"Path to Icon/Exe 5"
"Path to Icon/Exe 6"
'>
<menuitem name='${var:names}' icon='${var:icons}'>"${var:paths}" %*</menuitem>
</for>
</menu>
<!-- or... -->
<menu name='My Batch Menu 2' icon='Path to Icon/Exe File' class='* folder'>
<for names='"Item 1" "Item 2" "Item 3" "Item 4" "Item 5" "Item 6"' paths='"Path to Batch 1" "Path to Batch 2" "Path to Batch 3" "Path to Batch 4" "Path to Batch 5" "Path to Batch 6"' icons='"Path to Icon/Exe 1" "Path to Icon/Exe 2" "Path to Icon/Exe 3" "Path to Icon/Exe 4" "Path to Icon/Exe 5" "Path to Icon/Exe 6"'>
<menuitem name='${var:names}' icon='${var:icons}'>"${var:paths}" %*</menuitem>
</for>
</menu>
<!-- or... -->
<menu name='My Batch Menu 3' icon='Path to Icon/Exe File' class='* folder'>
<menuitem name='Item 1' icon='Path to Icon/Exe File'>"Path to Batch 1" %*</menuitem>
<menuitem name='Item 2' icon='Path to Icon/Exe File'>"Path to Batch 2" %*</menuitem>
<menuitem name='Item 3' icon='Path to Icon/Exe File'>"Path to Batch 3" %*</menuitem>
<menuitem name='Item 4' icon='Path to Icon/Exe File'>"Path to Batch 4" %*</menuitem>
<menuitem name='Item 5' icon='Path to Icon/Exe File'>"Path to Batch 5" %*</menuitem>
<menuitem name='Item 6' icon='Path to Icon/Exe File'>"Path to Batch 6" %*</menuitem>
</menu>
</config>
class='directory' will make the menu item appear only for directories (seems to act same as folder though)
class='folder' will make the menu item appear for directories and things like My Computer, Recycle Bin, drives...
class='*' will make the menu item appear on all files
etc...