Cannot set resolution in current export settings in AppleScript


Omnigraffle Pro version 7.9.3 (v192.17 r322419)

I wrote a function to export all the canvases in a given Graffle document below

on convertGraffleFile(graffleFile, outFile)
	tell application "OmniGraffle"

		set area type of current export settings to all graphics     -- Set export area
		set border amount of current export settings to 10. 	  -- Add border around exported figure

		open graffleFile

		set theDocument to front document
		set canvasCount to count of canvases of theDocument

		-- Get name of document
		set documentName to name of theDocument

		-- Iterate through every canvas in document
		repeat with canvasNumber from 1 to canvasCount

			-- Set the front window in theDocument based
			-- on current canvas number
			set canvas of front window to canvas canvasNumber of theDocument

			-- Get canvas name
			set thisCanvas to canvas canvasNumber of theDocument
			set canvasName to name of thisCanvas

			-- Assign output name using canvasNumber
			set targetFile to outFile & canvasNumber & ".jpg"

			log "Saving " & canvasName & " of document " & documentName
			save theDocument as "jpg" in POSIX file targetFile

		end repeat

	end tell
end convertGraffleFile

This works, however, when I try to set the resolution using

set resolution of current export settings to 4.0

the script raises the error

example.scpt:540:588: execution error: OmniGraffle got an error: AppleEvent handler failed. (-10000)

Why is this happening? Any suggestions for an alternative way to set the resolution for exporting files? I’m at my wits end with this one so any help will be greatly appreciated.

According to the OmniGraffle AppleScript dictionary, “current export settings” is read only - set should therefore not work. I write “should” because your working script also sets “current export settings” twice. But it’s possible to set the resolution of “export settings”. Another possibility would be to use the “export” command with properties for border amount and resolution and scope “all graphics” (see AppleScript dictionary for OmniGraffle).