OmniJS: Export image files from selection

I’m clearly being dim, but I cannot figure out how to use FileWrappers to export the selected graphics from a canvas. I would even be happy with all of the graphics on a canvas, or the entire canvas if it has a non-infinite size.

In OmniGraffle: FileWrappers there’s a recipe for shipping a PNG to OmniFocus, that I’ve tried to follow…

w = document.fileWrapper('public.png')
generates a FileWrapper with one child per canvas. Each canvas has no contents:
w.children[0].contents.length => 0

And even then, FileWrapper has no save() functionality.

Trying to set the preferredFilename of a child results in Omnigraffle crashing:

2018-07-31 11:17:10.779 PDT OmniGraffle: objc[75784]: __weak variable at 0x7f971ddbdfd8 holds 0x608001877b40 instead of 0x600000bf3000. This is probably incorrect use of objc_storeWeak() and objc_loadWeak(). Break on objc_weak_error to debug.

Any help would be appreciated to save my fingers from splat-option-e fatigue!

It isn’t your script that is the issue. Sorry for the confusion. Export via JavaScript isn’t implemented and working yet. It is something we started working on, and for that reason it is in the documentation, but it hasn’t been completed. We have a banner up now to explain the status and will remove it once it is fully implemented.

Okay, thanks for the confirmation Lanette! I’ll put a +1 in on the issue with support.

Perhaps through the pasteboard ?

(A new Preview file created with an OG selection in the clipboard can be saved as PNG, for example)