A lot of my apple script not work from OG 7.8 [How to adapt scripts for changes to export settings]

Today I upgraded my OG to 7.8.1 and then found that all my apple script is not working any more. The property “current export settings” is removed from OG 7.8.

There is any reason to remove this property, and are there any workaround to do the same thing?

Hi @jasongao,

The reason that current export settings was removed from our AppleScript dictionary, is we wanted to separate the ability to define the saved export settings in an OmniGraffle document versus setting up temporary export settings that are only applied by a script. With that change we now have just export settings which are the saved export settings for a document and a new export with properties command, which allows the script to export a file with its own independent settings. The changes you’ll need to make will likely center around using this new export command, as you’ll need to use this instead of the save command if exporting to a different file format (i.e. png, pdf, etc).

If you can share an example of one of your scripts, I would be happy to point out the changes needed to make it work again with the updates to our AppleScript support.

Thanks, the change is reasonable,

It seems that the release notes of OG7.8 doesn’t indicate this break change. So I download several versions and test one by one to find the changed version. Could you please add script break change to release notes? It’s very useful for the guy using script.

Are there any demo script for the new method? The url - “http://help.omnigroup.com/scripting” in the scriptTerminology seems invalid, it redirect to root page of support.omnigroup.com .

I use the following command to export,

export theDocument scope “all graphics” as “PNG” to POSIX file (path_without_ext & “@2x.png”) with properties {resolution:2.0, scale:1.0}

But the resolution property not work.

Sorry for the trouble here! The issue you’ve described with resolution sounds like one that we’ve addressed in the latest test build. If you’d like to download and install that test build to see if the issue is resolved, you can find it here: https://omnistaging.omnigroup.com/omnigraffle/

Thanks,
Lanette

Same issue, version v7.8.2 test (r314954)

Sorry! This looks to be a different bug specifically with the export with properties command. It seems it just isn’t using or respecting the supplied resolution or scale properties that can be provided right now. I’ll get a bug filed about this, and hopefully we can get that fixed soon. I should note there are some other bugs due to this change the we want to address (for instance, not all the same export settings that could be defined previously are accessible at the moment). So hopefully this will get much better soon.

For now, the workaround is to skip using with properties in the export command, and instead use set export settings to {resolution:2.0, scale:1.0}. Note this needs to wrapped inside a tell block for the corresponding document or written as set export settings of front document/theDocument to...

Sorry for the inconvenience this causes right now, but hopefully we’ll have these changes ironed out soon!

1 Like

Great, it works!

Thanks a lot.

Today I find the workaround not work for my new created file.

Before set the export settings, we must manually change the export type of the document to png.

Indeed it looks like the current export type set in a document can block the resolution property of export settings from being respected when set. I’ve filed a new bug report to let team know about this as well!

The workaround sometimes doesn’t work. A delay command is required between set command and export command.

set export settings of theDocument to {resolution:1.0, scale:1.0}
delay 0.05
export theDocument scope “all graphics” as “PNG” to POSIX file mypath

Can you clarify for us what goes wrong sometimes when you don’t add in this delay? Do you get an error or does the script run “successfully” but not do everything it should?

No error, the “set” command not take effect immediately.