View Single Post
This request has two parts.

I am trying to write a script which, given a few parameters, will create a series of shapes and perform boolean operations on them (intersect, subtract, etc.)

On top of this I'm trying to use the Unit Scale of the document so the end user can provide a value in feet, but I don't see how/if it's exposed via AppleScript. So for now I'm hard-coding it into the script, i.e.

Code:
set unitscale_left to 1 -- the inches
set unitscale_right to 12 -- the feet -- i.e. 1" = 12' in this case
set scale_dpi to 72
set unit_scale to scale_dpi / unitscale_right * unitscale_left -- i.e. 6 in this case
Using this unit_scale conversion factor, I create two shapes. (Let's say a square and a circle.) In my script, I've kept references to the two shapes as they're returned from OmniGraffle Pro.

So far, when I've created primitives, I have been able to use "Copy As Applescript" from the Edit menu in order to see how to reproduce them from a scripting standpoint. However, if I intersect the two shapes manually, I get an object with a crazy-long gibberish name:

Code:
make new shape at end of graphics with properties {name: "1F527F65-F94B-4590-BEFC-0C41E495370B-14690-0000C3313DE014D4", ...
Is there a way to cleanly use AppleScript to ask OmniGraffle Pro to intersect two items?

If not, I'm guessing I would need to 'do it by hand', or:

- Tell the app / window / document / canvas (whatever) to set selected of each of those items to true (or whatever; I don't know the exact syntax here)

- Do something with... menu item "Intersect Shapes" of menu "Shapes" of menu item "Shapes" of menu "Edit" of menu bar item "Edit" of menu bar 1 of application process "OmniGraffle Professional" of application "System Events"?

Thanks!