Possible to allow buttons to only be pressed for certain paths/filters?

I was wondering if it's possible to only allow a button to be clickable when the selected files/folders meet certain REGEX requirements or perhaps use a filter in Preferences/File Operations/Filters.

It would be nice to be able to have this feature if not. Having a FILTER argument for a lot of scripts' commands do not help because without the button being greyed out I don't know if I'm in the right folder or not based on how my files are organized, thus I won't know if the script ran when pressing the button.

See @ifpath

I meant the folder/file selected, not the folder you are currently in.

See @disablenosel and @hidenosel on the same page.