Add Search to Right-Click Context Menu


  1. Posts : 522
    Win7 Pro X64, Win10 Pro x640
       #1

    Add Search to Right-Click Context Menu


    I am requesting help modifying an eight-forums tutorial registry hack. The tutorial has not been updated for Win10 but works nonetheless.

    The Tutorial involves adding Search to the context menu of folders, drives, desktop background, This PC, as well as cabinet and compressed folders. The link is:

    Search - Add to Context Menu in Windows 7 and Windows 8 | Windows 8 Help Forums

    The problem is that, when using the right-click Search registry tweak on any arbitrary folder, a new window is opened and the Search is executed throughout This PC rather than within the specific folder and/or sub-folders.

    How could this right-click Search registry tweak be modified to perform Search the target folder and/or sub-folders rather than This PC?

    Closer examination of the registry file indicates two types of modifications:

    (1) re-enabling right-click search functionality to Cabinet folders, Compressed folders, Directories, and Drives by removing a LegacyDisable string in Find key; in this case, the search box is opened by calling CLSID string {a015411a-f97d-4ef3-8425-8a38d022aebc} from explorer.exe

    (2) creating right-click search functionality to Desktop Background folder and This PC by creating Search key; in this case, the search box is opened by calling a string explorer.exe search-ms:

    How could the above strings be modified to search the current directory rather than This PC?

    Thanks!
      My Computer


  2. Posts : 43,027
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #2

    Hi, purely as a demonstrator to show how explorer could be opened with focus at the search box, try running this small script (attached, in a zip file).

    All it does at present is open explorer at your Downloads folder and place the cursor in the search box.
    Now imagine that in a context menu entry where the folder path was passed to the script, so rt clicking a folder, clicking search, opened that folder in a new instance of explorer with the cursor in the search box.
    Is that what you are trying to achieve?

    Personally, I'm not sure it adds much by way of convenience...
    Add Search to Right-Click Context Menu Attached Files
      My Computers


  3. Posts : 522
    Win7 Pro X64, Win10 Pro x640
    Thread Starter
       #3

    Thank you for the reply.

    Your assertion is correct. I would like to modify the search context menu entry detailed in the first post where the folder path is passed to some sort of variable preferably or script, so right clicking the search context menu entry opens a new new search window (or even tab as I use QtTabBar) to search just that directory and/or subdirectories. The cursor does not have to be in the search box.

    I would have thought that some sort of variable to just search the existing folder or subfolders could be added but I don't know as I am not a coder.

    However, I do see your point that this change doesn't really add anything special since you can already just right click on a folder to open in a new window (or tab) and have the search box search in the desired folders and/or subfolders. But, since I always like to learn some command syntax, I thought I would ask.

    Does that help?

    dalchina said:
    Hi, purely as a demonstrator to show how explorer could be opened with focus at the search box, try running this small script (attached, in a zip file).

    All it does at present is open explorer at your Downloads folder and place the cursor in the search box.
    Now imagine that in a context menu entry where the folder path was passed to the script, so rt clicking a folder, clicking search, opened that folder in a new instance of explorer with the cursor in the search box.
    Is that what you are trying to achieve?

    Personally, I'm not sure it adds much by way of convenience...
      My Computer


  4. Posts : 43,027
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #4

    Would you be happy with that appearance of file explorer as per that exe file?

    The nexe step would be to incorporate that in the folder context menu and pass the path of the folder clicked on to the exe (Relatively easy - just haven't done it as there's no point spending the time if the result isn't what you want).

    First, this is the very simple autohotkey script I wrote:
    run, explorer.exe %Homepath%\Downloads
    ; Wait for window..
    WinWaitActive ,ahk_exe explorer.exe,Downloads
    ; ..then place cursor in search box
    Send ^f

    I would then replace %Homepath%\Downloads with %1%, which is the path parameter passed to a context menu entry, and use Easy context menu (useful freeware) to create a folder and desktop context menu entry.
    Last edited by dalchina; 17 Aug 2020 at 01:38.
      My Computers


  5. Posts : 17,838
    Windows 10
       #5

    Perhaps a program that incorporates a search filter, such as QTTabBar...

    Add Search to Right-Click Context Menu-000954.png
      My Computer


  6. Posts : 522
    Win7 Pro X64, Win10 Pro x640
    Thread Starter
       #6

    If an autokey explorer file would work, then I would be ok with that.

    My question is.....why can't you avoid autohotkey or easy context menu altogether and just use the %1% variable or whatever variable is appropriate for choosing the active directory to search along with the explorer.exe search-ms: command since the explorer search-ms: command is already built into windows? Or, when you enter some variable to open a command prompt in the current directory, why does that not work with opening a search window?

    Thanks!

    dalchina said:
    Would you be happy with that appearance of file explorer as per that exe file?

    The nexe step would be to incorporate that in the folder context menu and pass the path of the folder clicked on to the exe (Relatively easy - just haven't done it as there's no point spending the time if the result isn't what you want).

    First, this is the very simple autohotkey script I wrote:
    run, explorer.exe %Homepath%\Downloads
    ; Wait for window..
    WinWaitActive ,ahk_exe explorer.exe,Downloads
    ; ..then place cursor in search box
    Send ^f

    I would then replace %Homepath%\Downloads with %1%, which is the path parameter passed to a context menu entry, and use Easy context menu (useful freeware) to create a folder and desktop context menu entry.
      My Computer


  7. Posts : 43,027
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #7

    Thank you for your reply.

    why can't you avoid autohotkey ...altogether
    Try exploring the available explorer.exe command line options and see if you can resolve that. I had a quick play and could not combine both requirements in a single line.

    They are very limited- some say unofficial.

    why can't you avoid... easy context menu
    Here you misunderstand.

    Easy Context Menu simply makes it easy and convenient to add items to the registry that you could do manually. It's merely a tool.

    Compare the group policy editor in Pro. The tutorials often give the registry equivalent. But which is clearer and more reliable? Finding the correct keys in the registry and making the changes correctly, or using a tool with plenty of helpful text explaining the options?
      My Computers


  8. Posts : 43,027
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #8

    Hi, here's what I have now- have a look at the screenshots of how it works as a context menu for folders:
    Add Search to Right-Click Context Menu-untitled.png

    and clicking on that gives:
    Add Search to Right-Click Context Menu-2.png
    - open at that folder, cursor in search box.

    I've attached the source code and exe file - it took quite a little time as the precise syntax for string array handling proved more obscure than I'd expected.

    What you need is a copy of Easy Context Menu (free) and a screenshot of what I added using that.
    Or you could create the context menu manually or by other means.
    You can then give it whatever name and icon you wish.
    Add Search to Right-Click Context Menu Attached Files
      My Computers


  9. Posts : 522
    Win7 Pro X64, Win10 Pro x640
    Thread Starter
       #9

    dalchina said:
    Hi, here's what I have now- have a look at the screenshots of how it works as a context menu for folders:
    Add Search to Right-Click Context Menu-untitled.png

    and clicking on that gives:
    Add Search to Right-Click Context Menu-2.png
    - open at that folder, cursor in search box.

    I've attached the source code and exe file - it took quite a little time as the precise syntax for string array handling proved more obscure than I'd expected.

    What you need is a copy of Easy Context Menu (free) and a screenshot of what I added using that.
    Or you could create the context menu manually or by other means.
    You can then give it whatever name and icon you wish.
    That might work! Thank you! I will try out the script when I get home from work tomorrow.

    I am reading about command line switches and advanced search parameters. If a one-line command is going to work, it would involve something like explorer.exe (target directory), search-ms: or explorer.exe search-ms:folderpath or something like it. But after cursory testing it seems that a one line command won't do it.

    What is the %1% variable mean? What is the proper parameter to perform some action on an arbitrary directory?

    Thanks!
      My Computer


  10. Posts : 43,027
    Win 10 Pro (22H2) (2nd PC is 22H2)
       #10

    Hi, glad that looks the sort of thing you want. Here are the Easy Context Menu settings- note the options in the bottom right quadrant:
    Add Search to Right-Click Context Menu-1.png

    Also note how you can change the icon and context menu entry name easily.
    **Using this takes a couple more clicks in the GUI shown when you close that to apply the change, when you get a distinctive tone.

    %1% passed to a context menu handler is the full path of the item.
    The difficult bit was to then have a variable containing only the name of the folder - the last element in the path for a folder context menu entry- so as to identify the explorer window.

    You can see that in the string handling in the Autohotkey script. Could be tidier, but it was so pernickety and obscure getting the syntax right..
    But after cursory testing it seems that a one line command won't do it.
    Yep, as I said initially, the first thing I tried. Would have made it a whole lot easier.
      My Computers


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 08:00.
Find Us




Windows 10 Forums