Patrick Stahlberg


Software/Hacks

This is where I infrequently put up some scripts or patches I made. Please do also take a look at my little brother's homepage. He has a similar section with nice little programs.


Add JPEG comments to iPhoto keywords (2007).

[Download]

This script can be used to add keywords from JPEG files to Apple's iPhoto. The keywords are expected to be stored as a comma-separated string in the pictures' JPEG comment field. Please note that this is different from the more common method of storing keywords in IPTC fields.

Usage: Select the pictures in iPhoto and execute the script. It will assign the keywords automatically if they already exist within iPhoto. If they don't exist, the script will ask you for permission to create the keywords. Creating keywords works only if you have GUI scripting enabled in your system.

This is actually my first non-trivial AppleScript. It contains a (to my knowledge novel) way to work around AppleScript's failures when resolving alias files that are located inside of FileVault volumes. I highly recommend you to use this workaround, if you think your time is too valuable to deal with stupid AppleScript bugs.

I took much inspiration and some code from a script featured in an article on macosxhints.com, that does a similar thing for keywords stored in IPTC fields.


Automatically archive read emails (2007).

[Download]

I use IMAP a lot to read my email. I do not want to manually archive certain bulk messages (mailing lists, for example), and I also don't want those old emails to stick around in my IMAP boxes and make everything slow and big. Therefore, I wrote this little script (shell and procmail), which automatically moves read email from Maildir folders to archives which can be outside of the IMAP server's scope.

This script is designed to work with the Courier IMAP server, and needs to be run frequently via cron.


Automatically repair MP3 files (2005).

[Download]

This perl script uses the UNIX command-line tools "mpg123", "mp3asm" and "mp3check" to automatically check and repair MP3 files for common errors.

Please back up your MP3 files before you use it.