MacroHelp: How to "dupe:first_$param_letters_of_name"?

Discussion related to "Everything" 1.5.
Post Reply
TenTickles
Posts: 15
Joined: Thu Aug 01, 2024 10:03 pm

MacroHelp: How to "dupe:first_$param_letters_of_name"?

Post by TenTickles »

I'm trying to make the macro `gbfn:5` to dupe together files that have the same first 5 letters of their name.

Here is my attempt: `gbf:` defined as

Code: Select all

column1:=regex_extract($stem:,"^.{$param:}")  column1:  dupe:column1  groupcolors:

Based on a simpler parameterless macro I use that does work: `column1:=regex_extract($stem:,"^..") column1: dupe:column1 groupcolors:`


My experience with macros based on creating columns is that they're quite moody, they can work one second and then not work the second after. If a solution avoided it, that'd probably be better.

Any help is appreciated.
NotNull
Posts: 5961
Joined: Wed May 24, 2017 9:22 pm

Re: MacroHelp: How to "dupe:first_$param_letters_of_name"?

Post by NotNull »

Maybe one of the following filter definitions?

Macro = gbfn
Search =
nopath:len:>=$param: addcol:A A:=REGEX_EXTRACT($name:,.{$param:}) dupe:A



Macro = gbfn2
Search =
nopath:len:>=$param: addcol:A A:=left($name:,$param:) dupe:A



- nopath:len:>=$param: makes sure filename length is at least $param: characters long (5 in the example)
- addcol:A is oiptional (makes it easier to check if it's working OK
TenTickles
Posts: 15
Joined: Thu Aug 01, 2024 10:03 pm

Re: MacroHelp: How to "dupe:first_$param_letters_of_name"?

Post by TenTickles »

Thank you for the help. :D

Does it work on your machine? It doesn't on mine. I tried your two examples and some more.

I said addcol was moody but I think it's actually defining variables that is very moody, specially if I use the same identifier repeatedly. I didn't get this macro to work, but when I had issues with it, it'd work one minute but not the next. I'm not sure if there's a way to prevent this moodiness?

Code: Select all

addcol:A A:=REGEX_EXTRACT("test",.{4})
I tried this. I tried changing test to a bunch of things including $name: , or use these in a macro `gbfnalt:` but it didn't work.
void
Developer
Posts: 19870
Joined: Fri Oct 16, 2009 11:31 pm

Re: MacroHelp: How to "dupe:first_$param_letters_of_name"?

Post by void »

What version of Everything are you using? (Help -> About Everything -> Version)

NotNull's searches worked for me.



Please try the following search:

Code: Select all

regex:stem:^(.{$param:}) dupe:1 add-column:1
TenTickles
Posts: 15
Joined: Thu Aug 01, 2024 10:03 pm

Re: MacroHelp: How to "dupe:first_$param_letters_of_name"?

Post by TenTickles »

Thanks for the feedback, so the issue is on my end.

Version: Version 1.5.o.1403a (x64) , (version 1.5.0.1409 just became available)

Macro: Turning `regex:stem:(.{$param:}) dupe:1 add-column:1` into a macro `test123`, and querying `test123:4 ` works. I get an extra column that correctly displays the first 4 characters.
Post Reply