My First Applescript: Intelligent Photo Renaming

Before a week ago, the most time I’d spent on a mac was just playing around in the Apple store, while waiting for a Genius Bar kid to confirm that my salt-water soaked phone was indeed ready for the electronics graveyard.

But then, my laptop’s hard drive crashed, and I spent a night or two playing around on my wife’s Macbook Air. A coincidental promotion hit my email box, and fast forward to today, where I’m posting from my new Macbook.

Tonight, I wrote my first applescript. Applescript is a confusing but useful language that lets you automate a lot of things. There are operating system tasks, and functions that you can pass along to programs to do your bidding.

What I wanted to do was to import photos from my camera’s memory card. There’s software on the mac that will do it. And there’s more software from the camera company that will do it slightly differently. But I wanted one particular configuration available from the camera manufacturer’s software, but I didn’t want that software’s bloat.

What I specifically wanted to do was to is this:

Images are stored on my camera card with file names like IMG_xxxx.JPG, where XXXX is a sequential number. I want those files to live on with names like IMG_yyyymmdd_xxxsx.JPG where that middle part is the date that the picture was taken.

The applescript below does just that. I drag the files from the memory card to an app (icon) that has this script associated with it, and my desires are fulfilled.

As an added bonus, it moves RAW files to a subfolder named Raw. For movies taken by the camera, it changes IMG at the beginning to MOV, then moves it to a subfolder named Movies.

Perhaps this will help you do something similar in the future.

[/crayon]

If you’re interested in how to configure the scripts to run automatically, let me know, and I can post more about that configuration.

Posted in Apple, Applescript | Tagged , , , , , , | Leave a comment

Comments are closed.