How to get element id of omnigraffle

I want to get ID of element from a omnigraffle diagram to do some automation stuff. how to do it?

  • omniJS ?
  • JavaScript for Automation ?
  • AppleScript ?

In the GUI, it’s that final column in the sidebar ([2,3,4,5] below):

Screenshot 2021-11-09 at 12.48.36

Isn’t it also shown in the Property Inspector under Object Data? (matches what you see in the Sidebar under Layers or Outline for me)

Where would a unique ID be for an element?

Anything reasonably unique ( a UUID, for example ) would have to be supplied by the scripter and attached as a user property.

These IDs are just natural number ordinals, and they don’t persist between sessions.

To quote the entry for the id property of a graphic object in the omniJS interface:


var idNumber read-only

A unique identifier (within this canvas) of this graphic. Note that this value is NOT persistent across closing/reopening of the document.

I Need ID that is persistent

I Need ID that is persistent

  • omniJS ?
  • JavaScript for Automation ?
  • AppleScript ?

make a link to a specific element

If you are using AppleScript, you should be able to generate a new UUID:

-- newUUID :: () -> IO UUID String
on newUUID()
    current application's NSUUID's UUID's UUIDString as string
end newUUID

and then attach it to an element as a custom user property.