Since updating to version 7 of OmniGraffle, an important part of an AppleScript I use all the time doesn’t work properly any more. The script is pretty simple: it exports the currently selected canvas to the same directory as the OmniGraffle file, using the canvas name as the file name:
tell application "OmniGraffle"
set thedocument to front document
set thePath to the path of the thedocument
set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "/"
set theDirectory to (text items 1 through -2 of thePath) as text
set AppleScript's text item delimiters to ASTID
# Save the original canvas for restoration
set originalCanvas to canvas of front window
set canvasName to name of originalCanvas as text
# Configure the output type to all graphics
# Which will be interpreted as "current canvas" in PDF and EPS files
set area type of current export settings to all graphics
# Save as PNG
set pngFile to theDirectory & "/" & canvasName & ".png"
save front document in POSIX file pngFile
end tell
Everything works fine except this line:
set area type of current export settings to all graphics
In OmniGraffle 6, this would do what it describes – export a file that is the dimensions of the graphics on the canvas, regardless of the canvas size. In OmniGraffle 7, the script exports the whole canvas (including blank space), or if the canvas is set to autosize, it seems to export an arbitrarily huge canvas.
That’s super not helpful and makes me very sad. Changing “all graphics” to any other value doesn’t seem to do anything. Anyone have suggestions to fix this script?