Help needed with a certain renaming scheme

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Help needed with a certain renaming scheme Sat Dec 19, 2009 6:20 am • by Kha
Hey there,

I am trying to have Hazel automatically rename folders that has dots "." between the words as spaces " ". Example: "Brothers.&.sisters" should become "Brothers & sisters"

Ideally, it would be best to have 2 folders (A, B) that swap folder "X" between them. if dots are found then folder "X" is sent to [Folder B] that would do the renaming, and send it back to [Folder A] to do the rechecking and so on. If [Folder A] cannot find any dots then it would send it to the final destination folder. I used the rules "Name Matches" and had the first word "Blah1", and the second "blah2" set as "Anything" so it would capture whatever the words are. The Renaming was set to [Blah1 Blah2]

While this worked perfectly well when there is only 1 dot "Greys.Anatomy" turning into "Greys Anatomy", whenever there is a show that has more than one dot that needs to be turned into spaces, everything beyond the second word gets lost. For example, "Brothers.And.Sisters" would turn out to be "Brothers And". I assumed that "anything" rule doesn't count spaces as an allowable character so I tried another method.

The other way i tried is this. I had [Folder A] run a set of rules on the incoming folder to check the number of words in it and then run a set of rules depending on the number of words between the dots. For example, [blah1.blah2.blah3.blah4] should be treated as a 4 worded folder and should be renamed as [blah1 blah2 blah3 blah4] . I still got the same result as the other way above.

Here are the exported files for the two rule sets I did
http://www.zshare.net/download/7008397696fc0d00/

Could you please let me know how to do that with Hazel :)
Kha
 
Posts: 15
Joined: Sat Dec 19, 2009 1:28 am

This isn't readily easily in Hazel now (doing a search and replace on the whole text/name). I'm not sure how your rules are breaking (the concept seems sound though because of Hazel's limitations, a bit of a rigamarole) but you can use the Automator "replace text" option in the "Rename Finder items" action. Far easier.

I'm going to have to do another maintenance release because of some bugs and I am considering adding some sort of search and replace function. It's very unclear to me now where I would stick it, though. Any thoughts on how you would use it may help to clarify it (and increase the chances of it being implemented sooner rather than later).
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help needed with a certain renaming scheme Tue Dec 22, 2009 10:12 am • by Kha
Hello again

Thanks a lot for the Automator suggestion! It completely slipped my mind that I could do that! The scheme is a lot simpler now with that! With the combination of Hazel, Automatic, Transmission, and Plex, I have my TV shows downloading completely automated :D

As for the search and replace, you are talking about searching and replacing characters/words within the file name, right? The only thing that comes to mind is that when the "rename file" is selected from the drop down menu, two options with radio buttons would appear to choose from either renaming with pattern (the default behaviour now) and another option saying "Replace [Text field] with [Text field]", this way the user can choose which option to go for. This looks pretty straight-forward to me from a user-experience view of point :)

Since we are talking about implementing features, can I make a few suggestions from what I've experienced doing this project? :)

1- When I copied pattern fields to use in another pattern area, eg a pattern from the "If file matches...[pattern field]" to "Rename file with pattern [pattern field]", the pattern would sometimes be copied as simple text and some other times as the actual pattern. It was completely random and it didn't seem like it was related to something specific.

2- I had faced another problem when I moved the created folder to the destination folder. Because of Mac OS X's default behaviour, it basically replaced my old folder with the newly created one, effectively deleting a few gigabytes worth of videos! I had to spend a few hours to discover this problem and then correct it by using the shell script with the command "ditto" to merge the two folder contents together rather than replace it. I think that in the "Move file" to folder rule, there should be an option that says "If the moved item is a folder: Replace - Rename - Merge" so that others won't do the same mistake I did

3- This one is more of wishful thinking rather than an actual problem, I think it would be pretty cool if there is a way to link different rules together so that you can use outputs within a certain rule as an option for a subsequent rule. For example, in my hazel workflow I have Hazel check the video file name, place it in 2 subfolders deep with this pattern [TVShow name/Season #] then move the TVShow name to another drive. It would be amazing if somehow I can make Hazel send a growl notification saying that "Episode #X of X TV show is now ready to be viewed". This can be easily done if I send the growl notification prior to putting it in a subfolder, but not so after. Maybe an easier way to implement this is to give Hazel the ability to add "pattern" words in the comments area and then be able to scan them later on?

4- It would be awesome if there is a way where I can change the sequence of the items in the "Do the following" easily rather than having to delete and redo the items again in the right order

Thank you so much for your help. I didn't even think I'd be able to do all of this automatically before. Absolutely genius application :D
Kha
 
Posts: 15
Joined: Sat Dec 19, 2009 1:28 am

Thanks for the feedback.

I'm not sure if radio buttons will fit. One way I've been thinking about it is to offer it as an option in the menu for each token/attribute. For textual tokens, in addition to the capitalization options, have a "Replace text" item which brings up another small window where you can specify the parameters. This will allow you to control it to certain parts of the name without affecting others (such as numeric or date attributes which probably shouldn't be affected).

As for your other issues:

1. I'll look into it but I believe this is a shortcoming of the Apple UI element I am using. I am considering writing my own version though it's a large undertaking and won't happen until 3.0 if at all.

2. Merge is odd since Finder doesn't offer it. It feels like it would need user interaction which I've designed the Hazel actions to avoid doing. Also, how would merge work for regular files? The rule doesn't know what it's going to process until it actually runs.

3. There is already a feature in the database for allowing patterns in the comments action. The Growl action also has patterns now but I guess you are asking for the custom tokens to appear there? I'm not sure quite sure if I fully follow your example.

4. Already on the feature list for 3.0.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Help needed with a certain renaming scheme Thu Dec 24, 2009 2:55 am • by Kha
Merge is odd since Finder doesn't offer it. It feels like it would need user interaction which I've designed the Hazel actions to avoid doing. Also, how would merge work for regular files? The rule doesn't know what it's going to process until it actually runs it[/quote]

I don't think it necessarily needs interaction. If there is an option in Hazel specifically about moving folders that has the merge option, then it will be very clear that you are only able to merge folders and not files. This way you'll avoid user interaction and still get the point that only folders can be merged.

In my opinion a lot of people would imagine moving a folder to a target place that has that folder name already would merge them rather than replace it (especially Windows converters since thats the default behaviour of Windows). I think at the very least a warning should be put that "duplicate" folders are going to replace the folder rather than merge them.

BTW, I gave up on the Automator idea, its performance is spotty. I have had Hazel move folders with the dot in its name even though I have put the rule that only names that do not contain a dot are moved.
Kha
 
Posts: 15
Joined: Sat Dec 19, 2009 1:28 am

I'm considering some sort of replace function in the next release but again, there are details to work out. The possibility goes up greatly if I get feedback on it. As I mentioned before, the current thinking is to provide it on a token-by-token basis where there's a contextual menu item to replace text in it. If you have thoughts one way or the other, then please speak up here.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Mr_Noodle wrote:I'm considering some sort of replace function in the next release but again, there are details to work out. The possibility goes up greatly if I get feedback on it. As I mentioned before, the current thinking is to provide it on a token-by-token basis where there's a contextual menu item to replace text in it. If you have thoughts one way or the other, then please speak up here.


Hear hear! I heartily echo the need for string-swapping replace function (for filenames, folders etc). e.g. When the token is a period used in place of a space.

But I am wondering: how would the token-by-token basis / contextual item work when the token is just a non-extention-delimiting full-stop? Would you make a custom token for '.'? And then if you click on the custom token (e.g. edit token) ; you'd have the option to swap this string for a user-specified one? That makes sense to me...

I also want to explicitly request another feature...that I saw a hint of in one of Mr_Noodle's earlier posts. not sure this is the right place - but i really really need/want/would short of die for custom tokens in both Spotlight Comments and OpenMeta Tags. This. Would. Rock.

As background:
To this day I embed all my document context as '. ' separated key-terms in the filename of every file. This strategy is legible, human readable, and sortable in flat folder structures.

Essentially this is a *lot* of tagging/classification work embedded in each filename.

I want to take elements of the filename (these elements are '. '-separated) to create tags: but I need both spotlight comments and OpenMeta tags. For redundancy, peace of mind, and visibility.

Thanks for all your work on hazel. Love it.
textuals
 
Posts: 2
Joined: Fri Apr 09, 2010 1:56 pm

Being able to specify patterns in comments is on the feature list for 3.0.
Mr_Noodle
Site Admin
 
Posts: 11865
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support