Hello,
As I'm currently writing a presentation, I'm spending a lot of time doing or tweaking OmniGraffle files and exporting them as pdf. To streamline the process, I wrote a simple AppleScript that I bound to a trigger in Quicksilver. Here is the script:
The only small trouble with this script is that after running it, the document has forgotten where it's saved. So the process I follow is:
- open the document
- modify it and use the script
- close the document
The first step makes sure that the document knows its save location.
If someone knows why is this so, or has improvements to this script, I'd love to hear about it.
As I'm currently writing a presentation, I'm spending a lot of time doing or tweaking OmniGraffle files and exporting them as pdf. To streamline the process, I wrote a simple AppleScript that I bound to a trigger in Quicksilver. Here is the script:
Code:
-- files are assumed to be in some dir xxx/foo/file.graffle -- (typically xxx/graffle/file.graffle) -- the pdf file will be saved under xxx/pdf/file.pdf tell application "OmniGraffle Professional" set docName to name of first document set docFileUnix to path of first document end tell if docName = "Untitled" then display dialog "Save file first!" buttons "Cancel" default button "Cancel" else set pdfName to (do shell script "echo " & docName & "| sed -e 's/\\(.*\\)\\.graffle/\\1/'") & ".pdf" set docFile to POSIX file docFileUnix tell application "Finder" set rootPath to (parent of (parent of file docFile)) as text end tell set pdfFile to rootPath & "pdf:" & pdfName tell application "OmniGraffle Professional" save first document in pdfFile save first document in docFile end tell end if
- open the document
- modify it and use the script
- close the document
The first step makes sure that the document knows its save location.
If someone knows why is this so, or has improvements to this script, I'd love to hear about it.