The macro at Abbreviations: States, Months Macro requires you to select the state names, one-at-a-time, and run the macro. Is there a way to have a script change all state names in one series of find/replace steps, if you have a long list of addresses?
I guess I could build a macro with 50 find/replace actions, one for each state, but I'm hoping there's an easier way.
I'm the culprit behind that macro. Yes, it was designed to convert a single selection. I'm not adverse to providing a batched version but first I'd like a peek at the data you would like to feed it. It doesn't have to be the actual data, just resemble the actual data.
My first thought is the new macro would prompt you for a file to convert state names (as well as the format to convert to). And after conversion write a new file with the edited names.
...with instructions on running it from the Terminal. It did great, so I have something that works for future needs. But it would be so much nicer to just do it from the Finder with Keyboard Maestro.
He's not very familiar with Keyboard Maestro, but thought I might have AppleScript call the script. However, looking at the the "Execute a Shell Script" action, perhaps KM can run it directly. As you said, it would probably have to work on a closed file (selected file in the Finder).
on your original sample data in an open file. No need to select a file. The macro selects all the text, copies it to the Clipboard, passes that as a variable to the Perl code, which steps through each line making the substitution.
It could be optimized but it seemed pretty quick banging out one line at a time.