MD5 vs SHA-256 in the contextMenu



  • I originally misunderstood the question in [Feature Request] MD5 in the context menu: I thought it was being asked whether one of the MD5 menu entries could be added to the context menu.
    That is mildly easier: add the following to contextMenu.xml

            <Item MenuEntryName="Tools"           MenuItemName="Generate..."                 ItemNameAs="Tools|(MD5)|Generate..."                />
            <Item MenuEntryName="Tools"           MenuItemName="Generate from files..."      ItemNameAs="Tools|(MD5)|Generate from files..."     />
            <Item MenuEntryName="Tools"           MenuItemName="Generate from selection into clipboard"      ItemNameAs="Tools|(MD5)|Generate from selection into clipboard"     />
    

    However, I hit a snag: the contextMenu.xml syntax ignores submenus, so you just use the top menu name in MenuEntryName and the actual action name in MenuItemName, even if it’s buried a menu level down. However, that means that for the Tools menu, which has both MD5 and SHA-256, but the same three menu item entries under each, I don’t know how I’d disambiguate and be able to add the Tools>SHA-256>Generate from selection into clipboard, because MenuEntryName="Tools" MenuItemName="Generate from selection into clipboard" sees the MD5-version of that MenuItemName first.

    I tried MenuEntryName="MD5" vs "SHA-256" with the same MenuItemName, but that didn’t work – neither even bothered showing up in the context menu when I right-clicked.

    If any of the other power-users have ideas how to disambiguate between the two, I’d be interested (and would use any working solutions to improve the docs).



  • Hello, @peterjones and All,

    Really funny, Peter, because you already wrote the solution in N++ documentation : See here ;-)

    So, just run Settings > Edit Popup ContextMenu and add the section, below, right after the Style token - Remove style section, for instance :

    
            <Item FolderName="MD5..." id="48501"/>
            <Item FolderName="MD5..." id="48502"/>
            <Item FolderName="MD5..." id="48503"/>
    		
            <Item FolderName="SHA-256..." id="48504"/>
            <Item FolderName="SHA-256..." id="48505"/>
            <Item FolderName="SHA-256..." id="48506"/>
            <Item id="0"/>
    

    Just tested the six options, with N++ v7.8.5. Perfect !

    Best Regards,

    guy038



  • Well, I wrote that, but that’s not what it was meant to imply. The FolderName attribute is for making a folder in the context menu, not for accessing a folder from the main menu system.

    I didn’t remember that you could use an id="###" attribute instead of using the MenuEntryName/MenuItemName pair of attributes – though now that you say it, I can see it’s actually in the comments of the default contextMenu.xml. DOH!

    Still, I might add a couple of sentences about the MenuEntryName/MenuItemName vs id="", because none of those attributes are in the docs right now.



  • That is, BTW, one of the reasons I decided to take an active role in the documentation development: whenever I find there’s something that I cannot remember how to do, I check to see if it’s in the docs; if it’s not there, I like being able to add it in so that 6 months down the road, when I’ve forgotten it again, I can look it up. :-)


Log in to reply