Export All OmniGraffle Files In A Folder To PDF

So I cooked up this small script that opens all OmniGraffle documents in a folder, and exports them to PDF files. The PDF files are named the same as the Graffle files, and will be saved in the same folder.

To use it, just load up Script Editor, paste, compile, and run. Of course, you could also save it to the AppleScripts folder so you can easily access it.

tell application "Finder"
  set the theFolder to choose folder with
    "Pick a folder containing the OmniGraffle files you want to export to PDF:"
  set theList to every file of the theFolder whose
  name extension is "graffle"
end tell

repeat with theFile in theList
  set theOutFile to ((do shell script "basename \"" & (theFile) & "\"" & " .graffle") & ".pdf")
  set theInFile to theFile as string
  tell application "OmniGraffle Professional 5"
    activate
    open file (theInFile)
    save front window in file theOutFile
    close front window
  end tell
end repeat

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s