Creating a Table of Contents in OmniGraffle with AppleScript

Updated 14th of July 2012!

This post is for all interaction designers out there using OmniGraffle. Most of us use OmniGraffle for making flows and documenting wireframes (documenting, not drawing, but that is another post) and our documents tend to get long, like over 50 pages. A table of contents would be nice, but this button is nonexistent in OG…. Since I started using OmniGraffle a few years ago I already was searching the web for a solution, but found nothing really useful until last week. I improved the method and now it is possible to create a ToC in a single click. Great until OmniGraffle 6 comes out (it is in there, right?).

Note: Recently the guys at IQContent took this script and added new features.

Issues with OG 5.4
We had some comments on the blog that the script did not work as expected with Omnigraffle 5.4. We checked out the issue and it not the script, but OG. It will work in the version 5.4.1 which will be out soon. For now, just run the script, select the ToC (just the lines) and select a font and color. The ToC will be visible now.

New features
Thanks to the great people leaving comments we made some tweaks to the script. We added font color as a variable and added some information on how to find add your favorite font to the script.

Table of Contents in OmniGraffle

I found this post, from a guy called Joshua Dickens. An AppleScript that automatically generates a TOC from all your canvases. Nice, thanks Josh. I made some improvements to the page numbering. This was not working out for our documents as the order of the canvases in a document has nothing to do with the canvas ID. Also I added some easy configuration and a multiple column layout and of course some oral feedback, as this is the first AppleScript I have written :).

Can’t wait?

Download the script

What does it do

  • Adding a Table Of Contents of all your canvases to the second canvas of the document based on the Canvas TitleYou can change it to the first or third or every canvas you like. You probably figured out to use “<%Canvas%>” as a canvas title.
  • If the list gets too long (you decide how long it should be) it automatically creates a new column. Ideal for landscape documents, like ours.
  • If you open the document in presentation mode (View > Start Presentation) or export as PDF, the TOC will link to the page. How cool (thanks agian Joshua, that’s his part)

How to use it


I advice to first change the script so it will fit your page setup and style

  1. Download the script and unzip
  2. Open “Create Table Of Content.scpt” with AppleScript Editor
  3. Change configuration. See the script comments for explanation. The default values are based on our company template, which is probably different from yours.
  4. To get your font:
    1) Create some text in the font that you want
    2) “Copy As…” in the edit menu and select Applescript
    3) Paste it somewhere, applescript editor, text editor, in OG. You’ll see somewhere in the text font:”NameOfTheFont-ExtraBits” – that’s the name of the font as Omnigraffle sees it.
    4) Copy and paste that font name into the TOC script
  5. Open an OmniGraffle document
  6. Create an empty second canvas
  7. Run the script
  8. Tweak configuration

Getting easy access to the script

  1. Open your AppleScript Editor (of course using Launchbar, Quicksilver or spotlight if you will)
  2. Go to preferences, tab general and select “Show script menu in the menu bar” and show computer scripts at the top
  3. Open Omnigraffle (we use OmniGraffle Pro 5.2.3 at the moment)
  4. Click  in the menu bar and select “Open Scripts Folder > Open OmniGraffle Pro Script folder”
  5. Drop your unzipped file in the folder
  6. Restart OmniGraffle

From now on, just do this

  1. Open any OmniGraffle document
  2. Make some space on the second canvas
  3. Run the script using the icon in the menu bar
Joshua Dickens