Does anyone know if it's possible to create a macro that renames files in a folder based on a list in clipboard?
The files are numbered (or at least they all contain a number in a sequence) and each should be renamed from
number1.jpg
to
first-new-filename-from-clipboard.jpg
etc.
Any suggestions? Im new to KM and slowly trying to build macros. So I just want to know if I'm heading down a dead end or not.
Sure you can, but personally I think this is a very bad idea – there are too many things that can go wrong.
I think it's better to actually map your replacements directly, so there can be no mistakes with sorting or interruption of the Clipboard – etcetera.
Personally I'd use BBEdit, because it's very scriptable.
I recommend BBEdit because…
Although BBEdit is a commercial product, the trial version reverts to a
still very powerful and free (BBEdit-Lite) version after 30 days.
It is very Mac-like.
It has excellent support for RegEx.
It is very AppleScriptable.
It has a two versatile command line tools.
It has been in continuous development for over 25 years.
A decent alternative is CotEditor, but it's not nearly as powerful as even the free version of BBEdit.
Another alternative would be Apple Numbers.
So your document would have a tab-delimited table of name-value – rename-value:
number1.jpg first-new-filename-from-clipboard.jpg
With enough tab separation to create a neatly ordered table.
You then use an Execute an AppleScript action to get the values into Keyboard Maestro and process from there.
Let me know which way you want to go, and I'll provide some more guidance.
Interestingly I just looked at BBedit last week.
I use VScode and Sublime and they seem fine for almost everything I'm doing so far.
Happy to go with either method but intrigued by the first one, which I guess is some kind of shell script?