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

RegEx support for pattern property

arathburgos05 opened this issue ยท comments

๐Ÿ—„ This PR is not necessary. RegEx necessity was covered using Exprtk provided by the tool.

๐Ÿ”–NOTE: At the beginning my issue was not clear at all so I decided to re-write it.

๐Ÿ“„ Is your feature request related to a problem? Please describe.

First of all great work! I'm impressed of the flexible, powerful and complete documentation of the program.

I needed to validate in multiple selections that:

  • The selected folders were inside of a specific pattern path.
  • AND That parent folder of selected folders has a specific folder name (IN).
  • AND That selected folders doesn't contain "." and ".ws_" prefixes.

Due to I was new using this tool I didn't know how to do that.

๐Ÿ”ฎ Describe the solution you'd like.

However, tool has something similar to RegEx called exprtk. Which was useful for my purposes.

<validity class="directory" exprtk="
        ('${selection.path}' ilike '*\test_folder\test_name_clasification_1\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_2\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_3\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_4\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_5\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_6\IN\*'
          or '${selection.path}' ilike '*\test_folder\test_name_clasification_7\IN\*'
        )
        and ('${selection.parent.filename}' like '*IN*')
        and (
          not ('${selection.filename}' ilike '.*')
          and not ('${selection.filename}' ilike '.ws_*')
        )"/>

โš  NOTE: I'm aware that I'm overloading a little bit the conditionals ๐Ÿ˜†. I hope not crash the tool. I've been using the tool for one month and I didn't see any important issue. The only issue that I found (I'm not sure if it's related to my config.xml, exptk or an error in the tool) is that when I do right click sometimes menu appears and disappears (like If I were clicked in other side by error).

๐Ÿ›  Describe alternatives you've considered.

Maybe there are more efficient ways that I haven't found in the documentation.

๐Ÿ”Ž Additional context

None

Problem solved by further researching the documentation. Sorry for opening this PR unnecessary.

Thank you for the feedback. It is much appreciated.

I am glad you found an alternate option to RegEx. Exprtk expressions are not Regular Expressions but they are similar. I think at the time of the implementation, I was looking for something that would work as close to Dos command such as dir *.exe.

Regular expression would be a great addition to Shell Anything. It could be added in a future update. Feel free to open a new issue for requesting this requirement. However, I must say that my free time is quite limited now and I do not think I will have time to implement such a feature in the next 6-12 months.

For the moment, I think this is not needed. In my opinion RegEx necessity is covered by Exprtk. I've updated the post and the format to clarify what was needed just for documentation purposes (that night I was tired and I didn't even know what I wanted ๐Ÿ˜†).

One question @end2endzone, does someone reported you that contextual menu open and closes suddenly sometimes? I'm not sure if this is a problem of my complex exprtk condition, a general problem with exprtk tool or another option.

Regards ๐Ÿ‘

@arathburgos05, sorry for the late reply. I did not noticed the question since the issue was closed.
No, I am not aware of an issue that makes the menu open and close suddenly.

I know it is not a crash of Shell Anything. Shell Anything DLL is "linked" to the owner process which is Explorer.exe. In case of a crash of Shell Anything, your Explorer.exe process would also crash.

Shell Extension do not control when a menu is displayed or hidden. They provide/feed the menu new items to display. Your problem may be the result of incorrect/invalid content that your configuration files try to add to the menu. I would suggest looking at your log files or investigating you configuration files one by one using a trial and error approach.

If you find reproducing steps, or hints on how why this would occurs, I would gladly investigate. If so, please document your observations in a new issue.