How best to rename many text files?

Sweet! That’s exactly what I did in the updated macro. The Break from Loop method works great if you only care about the first line in a collection :slight_smile:

You can get trickier to capture other lines, but we don’t need that here :sweat_smile:

You can safely export your macro by selecting the macro, then File_Export_Export Macros…

Opening that exported macro in Finder will import to KM in disabled state.

My current problem is the try / catch is not working as expected.

I expected the if the file already exists (error) then it would execute the catch which would add the random and timetag unique text and save ok. but it does not - I get the error:

File action failed because destination already exists…

Any Idea how to get this working so the file will save simply and add the unique text only if needed?

Also when I try to upload the macro it is grayed out and I cannot add it. How can I upload the km macro?

Are you trying to upload the macro directly to this forum? That may not be allowed. Try uploading it elsewhere and sharing a link. Once you get it uploaded I will take a look. You could also post on the KM forum, which does allow uploading macros :slight_smile:

ok good point - I was able to get a first version uploaded here…

Zabobon was able to fix the try catch here…

All working well now…

Awesome. The KM community is so helpful. Love it.

That’s interesting what the solution turned out to be on the Try/Catch action, because I read the help section on it earlier today when you posted, and I did notice this wording:

If any action in the Try sequence would abort the macro, the macro instead continues executing the Catch section

So it is right there in black and white, but definitely not obvious. Good to know!

Glad you got it working :slight_smile:

1 Like

AND THANK YOU for getting this started so well!

Hi Evan,

I ran into a new issue this morning with text-encoding-errors trying to read Microsoft Word and Pages app basic files.

Curious if you have any suggestions to fix this?

As you can see - this is an excellent fix for word Doc issue… mr pasini…

Convert the Word docs to text using the built-in textutil utility: