Toggling layers in OmniGraffle

Sometimes I need to output PDFs of a wireframe produced in OmniGraffle in two versions, one with annotations and one without. Luckily I habitually put all annotations on their own layer, so all that’s needed is a simple AppleScript to tell OmniGraffle to toggle the printable and visible nature of every layer named “Annotation”. A bit of googling turned up this forum post which does most of the work, I just needed to add in the printable property. So, if this is something you do a lot in your OmniGraffle document this script could save you a lot of time.

Disclaimer: If this kills your OmniGraffle document it’s your fault not mine. It’s tested and working perfectly in OmniGraffle 5.2.1 but your milage may vary. Back up your document first.

This is also, for some reason, the first time I’ve ever even looked at AppleScript. I’m gonna play with it a bit more in future.

UPDATE: I’ve now added two more useful scripts, both prompt you for a layer name before locking or unlocking all instances of that layer depending which script you choose.

Download the scripts here.