Export to HTML Imagemap via Script Not Working Anymore

I used to be able to use applescript to export to html files with a call:

set tp to "/foo/bar/test.html" save currentDocument in tp

It created an html file with an image map. Now it creates a Graffle file “test.html.graffle”.

If I add:

set tp to "/foo/bar/test.html" save currentDocument as "html" in tp

Now, it says:
OmniGraffle got an error: The document cannot be exported to the "HTML text" format.

I can do “png” and make a bunch of pngs. Is there an “Image Map” format? Any help would be appreciated.

save currentDocument as "html" in tp

could be changed to

save currentDocument as "com.omnigroup.omnigraffle.HTMLExport" in tp

that should do it.

Here’s a js for automation version that works:

var g = Application('OmniGraffle')

g.save(g.windows[0].documents[0], {
    as : "com.omnigroup.omnigraffle.HTMLExport",
    in : Path('/Users/example/Desktop/blah')

Export to a directory sandboxing is okay with, too.

We have a bug filed to make the shorter identifier work.

(Formatting became jankified during copy/paste, fixed thanks to thanks draft8!)

1 Like

FWIW, the forum software can make things a little clearer with Github markdown fenced code blocks :- )


var g = Application('OmniGraffle');

g.save(g.windows[0].documents[0], {
    as: "com.omnigroup.omnigraffle.HTMLExport",
    in : Path('/Users/example/Desktop/blah')

1 Like