Text editors are great if for no other reason than that you can execute a search and replace function. This little tool has saved me countless hours of tedious, mind-numbing text replacement exercises. But what happens when you need to alter several items outside of a text editor? Say, files in the Finder…
Ok, here’s what lead me to our discussion today:
When I post my family photos to the internets, I use SlideShowPro. When I’m prepping my images for viewing through the SlideShowPro interface, I scale them down so they load quicker. Any long-time reader here will be anything but surprised to find that I use Quicksilver to quickly process whatever size batch of photos I’ve got. Quickly, here’s how:
The result of Quicksilver’s scaling action however, duplicates my original image files and adds a ‘ 1′ before the file extension. So now I’ve got say, 25 files that I need to have their names cleaned-up. While it’s easy, it’s a bit tedious – especially when I know there’s better way of doing it…
Enter Apple’s Automator. This app really is awesome, and I don’t utilize it nearly enough. But I launched it and within about 5 minutes I had a working solution, specific to my problem. Here’s what that looked like:
So I ran it and it did just what I wanted. Brilliant! I love when a plan comes together.
It needed a couple of tweaks though. I’d rather select the items and then initiate the script, rather than the other way around. So I changed that. I also realized that it’s not very efficient having such a specific search and replace script when I may have different needs in the future. A quick tinker (expand the Options on the rename step, and check the ‘Show Action when run’) and my result was this:
When it runs, here’s how it looks:
You can save this Automator script to the Scripts folder, which you may have accessible from the menu bar, but I’ve gotta tinker a bit more. So I instead saved the workflow as a plugin (look for it under the File menu) for the Finder. So now all I do is select the files I want to do a search and replace on, right click (ctrl + click) the selection, and choose Automator->replaceScript. It’s that simple.