Problem with svg export on Version 7.8.1 and later

Prior to release 7.8.1, I was able to run this applescript successfully to export svg from graffle files. Starting with 7.8.1, it no longer works.

The error reported:

“A property can’t go after this identifier.” referring to “area type” below.

tell application "OmniGraffle"
set area type of current export settings to all graphics
open "Users:username:path:file.graffle" 
set theDocument to front document 
set canvas of front window to canvas "Canvas Name" of theDocument
tell front document to save in file "Users:username:path:file.svg"
close front document
end tell

Unfortunately, I can’t fine any spec for the applescript API to see how I might change this to make it functional again.

Sorry for the trouble here! Please check out the information in the post from @valyria at A lot of my apple script not work from OG 7.8 [How to adapt scripts for changes to export settings] for the best workaround to use for now.

Thanks,
Lanette

Thanks for the advice. I had looked at that posting but wasn’t able to figure out how to use applescript (or any other method for that matter) to export a graffle canvas to SVG via a command line utility.

If there is any documentation or suggested script that can achieve this, I would love to see it. What I posted above was how I used to do it.

Hi @jshrall

A couple of changes are needed to the script you were using:

  1. Remove the set area type of current export settings... line.
  2. Switch out the save command for our new export command. You’ll specify the export area type using scope in the export command.

Here is what the revised script should look like:

tell application "OmniGraffle"
	open "Users:username:path:file.graffle"
	set theDocument to front document
	set canvas of front window to canvas "Canvas Name" of theDocument
	tell front document to export as "SVG" to file "Users:username:path:file.svg" scope all graphics
	close front document
end tell
1 Like

Thanks, this works with one exception. It seems like the ‘close’ is happening before the SVG export is complete. What I see is the SVG is only a partial SVG, not the full thing. By adding this into the script, I was able to generate the full SVG (for a fairly simply document). I haven’t tried anything complex, so I don’t know if the time scales with the complexity of the document.

tell application "OmniGraffle"
	open "Users:username:path:file.graffle"
	set theDocument to front document
	set canvas of front window to canvas "Canvas Name" of theDocument
	tell front document to export as "SVG" to file "Users:username:path:file.svg" scope all graphics
    delay 1.0
	close front document
end tell