Export settings via AppleScript and OmniGraffle 7

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?

Works for me when I use “current canvas”. Can you try “all graphics”. Note the quotes.

I meet the same problem.
I change the area type of export setting to All Objects in the OmniGraffle GUI, then read the value of area type in applescript, it’s “all graphics”.
But it always export the whole canvas by using applescript…

The script works well in OF6.

I only see the issue when exporting via AppleScript — whatever options I use when manually exporting works as expected.

The only workaround I can see so far is to export to SVG and alter the view bounds before converting to PNG using some other tool; this is far from ideal though!

I have started my own thread on something similar.

A script that aligned text and worked fine in OG6 is now broken (all text is centred).

Every time OG is ‘improved’ my first job is to figure what they’ve broken.

Argh… I upgraded to Pro today specifically to use the AppleScript export feature, and now I learn that I cannot export “All Objects (Current Canvas)” to pdf.

I’ve learned that I can work around using the “pdfcrop” tool.

We’ve fixed this bug in the latest test builds of OmniGraffle 7.4 (r290118 or later). Sorry it took so long for us to track this down!