end2endzone / ShellAnything

ShellAnything is a C++ open-source software which allow one to easily customize and add new options to *Windows Explorer* context menu. Define specific actions when a user right-click on a file or a directory.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Menu visibility only for drives ?

ggbbrr opened this issue · comments

Is your feature request related to a problem? Please describe.
Not really a problem/bug. How can I make a menu appear only for drives?

EDIT : Sorry, I just saw class attribute: drive.

EDIT2 : class attribute: drive is not right.

Please provide a example for exprtk in the User Manual.

Hi. Please apologize for the late reply.

It all depends what you mean with a "drive". The following should get you started:

<menu name="This menu is visible when right-clicking C, D, E, ... Z root directory using pattern validator">
  <!-- this is the fasted and recommended way if a drive is any root drive directory -->
  <visibility pattern="?:\" />
</menu>

<menu name="This menu is visible when right-clicking any file or directory on a physical hard drives">
  <!-- for example, usb drives are removable drives, not fixed -->
  <visibility class="drive:fixed" />
</menu>

<menu name="This menu is visible when right-clicking C, D, E, ... Z root directory using exprtk validator">
  <!-- 
  An exprtk example as requested. Not recommended. Note the escaped `\` characters.
  If you right-click on `C:\Program Files\Google\Chrome\Application\chrome.exe`, you will generate warnings because the exprtk expression is malformed. 
    W0514 19:40:24.282965 25080 Validator.cpp:796] Failed evaluating exprtk expression ''C:\Program Files\Google\Chrome\Application\' ilike '?:\\''.
    W0514 19:40:24.282965 25080 Validator.cpp:797] Exprtk error: ERR004 - General token error: \\'.
  -->
  <visibility exprtk="'${selection.path}\' ilike '?:\\'" />
</menu>

Close the issue if the examples above resolve your issue.
If these examples are not what you are looking for, please provide more details.

And if you appreciate ShellAnything, consider leaving a star to the project for motivation 😉

Thank you will try. This is a nice project.

I already mentioned it here :
http://reboot.pro/index.php?s=d6240059cba83ab2f7ab36b5e2f8ef1b&showtopic=23023
and here :
https://techenclave.com/threads/shellanything-easily-customize-and-add-new-options-to-windows-explorer-context-menu.219954/

Please fix the probs with the menu in the navigation pane (double entries).

I had tried this exprtk="'${selection.path}'[] < 4". It did not work.
I want a menu to appear only when the user right-clicks any drive (hdd/ ssd/usb).

I want a menu to appear only when the user right-clicks any drive (hdd/ ssd/usb).

I would recommend using the pattern attribute :

<menu name="This menu is visible when right-clicking C, D, E, ... Z root directory using pattern validator">
  <!-- this is the fasted and recommended way if a drive is any root drive directory -->
  <visibility pattern="?:\" />
</menu>

I had tried this exprtk="'${selection.path}'[] < 4. It did not work.

I think it is because the property selection.path is not escaped properly. Automatic escaping is not a supported feature. It should be <visibility exprtk="'${selection.path}\'[] < 4" />. Note the additional \ at the end.

This option is far from optimal. Like I said, it will create warnings for all subdirectories.

Wish it were more portable-friendly (user can specify location of config files, allows relative paths ...)

Feel free to open an issue so that I can track this requirement.

Oh, I almost forgot! Thank you very much the posting about ShellAnything. Much appreciated!

both visibility pattern="?:" and visibility exprtk="'${selection.path}' ilike '?:\'" work.

will do some more SA testing this weekend.