Photo Corners

A   S C R A P B O O K   O F   S O L U T I O N S   F O R   T H E   P H O T O G R A P H E R

Enhancing the enjoyment of taking pictures with news that matters, features that entertain and images that delight. Published frequently.

The Life Expectancy Of Software Share This on LinkedIn   Share This on Google   Tweet This   Forward This

14 July 2016

As we mentioned on Monday, we completed our migration to Mac OS 10.11.5 from 10.10.5 over the weekend. And we've been running without a hitch since then. Smoother than ever, in fact.

Which is always dangerous.

One glitch we resolved on the first laptop we migrated involved a watched folder which had our image ingestion script attached to it. For some reason it was prompting us for a new destination folder name for each image.

We thought it was us, of course. Some code wrapped in the wrong loop. But no, it wasn't us. Things had just changed a bit for our Automator action in AppleScript.


We spent a while trying a few alternate approaches to resolve the issue but we weren't happy.

We'd just spent a few days converting our image utilities to add copyright and resize images from AppleScript to a nice palette in Keyboard Maestro, which included an HTML form for non-standard cases. And we loved it.

Image Resizing. Our HTML form for Keyboard Maestro.

It was fast and convenient, unlike the AppleScript, which required drag-and-drop dexterity and took a while to run.

So why prop up our AppleScript code for the ingest script?

Well, because it's complicated, that's why. There are a series of dependent prompts that get all the options from us before calling both DNG Converter and ExifTool to convert the images, apply copyright and archive them in an appropriately named folder.

So we bit the bullet.


Keyboard Maestro has all the commands we'd need to write the prompts and branch off into shell scripts to run DNG Converter and ExifTool. So we started our conversion there.

The trouble became apparent quickly, though.

Keyboard Maestro has something of a graphical editor for code. An if-then-else construct, for example, has little windows you plug your code into. And this takes up screen space. If you're editing a hundred lines of code in a shell script, this can require a lot of scrolling.

You can, however, also point Keyboard Maestro to a file holding your script and edit away in the editor of your choice. And that's what we did using the new version of BBEdit, in fact.

So we decided to code the ingestion script strictly in Perl, linking it to a macro keystroke in Keyboard Maestro, rather than use Keyboard Maestro's built-in actions.

That approach beats a watched folder. We'd continue to use Image Capture to import our images but then we'd just hit the key chord to run the ingestion code.


It makes sense now but we had ourselves tied up in knots for a day rethinking the AppleScript code. We were so unproductive, we thought we should hang up our mouse and go fly rocks.

But you're never really unproductive when you're thinking about things. You're tilling the soil where the crops will grow. Only people who have never tilled soil would think you're not productive because nothing has sprouted.

Rethinking the code was fun. Why were we doing that? Why not try this? Oh, that's why! But how about doing this? Hey, that works. It's better.

A funny thing happened on the way to the Forum.

Once we started putting the pieces together (one debug print statement after another), we didn't want to stop.


Perl was great for concisely ordering operations but it doesn't itself offer a graphical user interface. So we built our dialogs and progress bar using CocoaDialog.

CocoaDialog. A simple prompt to convert Raw files to DNG.

Once we had the logic in place, we expanded the user interface using CocoaDialog assets. We even added a directory selection dialog to confirm or switch the source directory, something we didn't have with a watched folder.

The progress bar was a nice touch but the prior code used sound effects built into the system to inform us that each image was being processed. We liked that because it confirmed the files were being ingested but we didn't have to watch anything and could get back to work.

But why settle for a mere beep?

Instead, we tapped into the system say command to talk to us. And if someone was going to talk to us, why not have it be the high-quality Federica voice? And if it was going to be Federica, why not have her talk to us in Italian, her native language?

Even that charming voice, though, could be annoying confirming each conversion for dozens of images. So we varied her inflection with punctuation depending on the modulus of the number of files processed.

That was fun.


We started with a script that misbehaved after an operating system upgrade and ended up with a more elegant, efficient way to get our images where we want them in the format we prefer.

It wasn't smooth sailing but our initial difficulties turned out to be an advantage. It gave us a chance to rethink the process, making it a little more versatile as we moved the code to a more powerful language. It always worked for us, but now it works for any workflow and promises to be even more adaptable in the future.

Image ingestion has always been one of those unavoidable chores in digital imaging. But we're actually looking forward to chatting with Frederica the next time we have a card with new images to copy.

Old software never dies. It just keeps evolving.

BackBack to Photo Corners