OmniGraffle Applescript Export - Uses up all RAM and crashes

Hello Omnigroup,

I’m trying to export my current document to a PNG using AppleScript. Whenever I run the following (seemingly simple?) script, OmniGraffle starts taking up more and more system RAM, and within a 20-30 seconds, has completely consumed available memory, until OS X makes me quit some application to continue using my computer. (oh, and the file isn’t actually exported)

What am I doing wrong here?

tell application "OmniGraffle"

	set theDocument to front document
	tell front document to export as "PNG" to file "Users:jcrystal:Desktop:test.png" scope entire document
	
end tell

Thanks!

-Jason

Here, your script (with “jcristal” in the file path adapted to my system) runs without any problems - whether saved as script or app and it does also run without problem if the front document is not saved before. The script seems to be correct. I use OmniGraffle 7.10.2 (v195.13 r328142) with macOS 10.14.5.

Hi Jason,

Sorry to hear about the trouble exporting. Can you export a simple 1 canvas document with one shape on it using this script?

If a simple document exports with this script, but your document doesn’t, there may be an issue with the document you are exporting. Are you able to export this document using the export dialog in OmniGraffle? If possible to share the file with us, please email us including a file that can reproduce this problem using Contact Omni from the help menu.

If you aren’t able to share the document, and you can export simpler documents to PNG using this script, you can isolate the cause of the problem using the half & half technique.

Using Half & Half Isolation

  1. Duplicate your OmniGraffle file twice.
  2. Remove half of the content in the first file copy.
  3. Remove the other half of the content in the other file copy.
  4. Export each smaller file to PNG.
  5. Repeat until you have identified the smallest possible set of factors (canvas, graphic, line, layer) that is causing the problem.
  6. Let us know what was causing the crash so that we can fix the issue.

Thanks,

Lanette