How to force a screen refresh through AppleScript?

Hi there,

I have an AppleScript that calculates an area of any Bezier shape and creates a user data key+value pair for that shape.

I can also get the value to be displayed in the GUI adding the following text to the shape <%UserData area%>.

However my problem is that when I change my shape and re-run the AppleScript to calculate the new area, the data value is not updated until some kind of refresh event such as moving the screen, changing the zoom, etc.

How can I trigger a refresh (like slightly changing the zoom of my current window) through AppleScript so that I can get the current value to display on my GUI automatically?

Thanks in advance!

Probably worth a direct question through the Help > Contact Omni

Slight mismatches/lags between GUI view and script-adjusted model state come up in a number of places – connecting lines between script-moved shapes, display of script-adjusted text, etc etc.

I’m not sure that there is a simple solution in current builds – my impression is of a race condition which the script thread sometimes loses, but do share any solution that you learn of …

I might wonder at the start of the re-run of the Applescript within the Applescript …

  • What happens when you move the window position?

  • What happens when you re-issue an activate command?

  • What happens when you use AppleEvents to zoom / unzoom from the menu (presuming this is not a direct ApplesScript-accessible option)?