OmniJS & "active" graphics a possibility?

I’d like to know if OmniJS will eventually be able to power a graphic symbol (group) when it is being manipulated on the canvas. E.g., I would like to create symbols (groups) with specific connection points that permit connections from specific lines or other symbols. The idea is to be able to create simple block schematics that, when drawing, ensure wrong connections cannot be made (powered by my own OmniJS written logic).

I guess this would mean that code is attached to symbols, that symbols+code can live in a library and can be dragged onto the canvas and that the code is activated while the symbol is actively manipulated or connected to while on the canvas.

Kinda like, dare I say it, Visio ?

Is this in the pipe line guys/gals or… not at all?

We have actions which allow you to run an Automation Action when tapping on a graphic from a plug-in. More information on Plug-Ins at We also have stencils which can be saved with specific magnets and actions on them, and then accessed by your actions. Please let us know if there is a bug or something missing that is getting in your way of accomplishing this with stencils, Plug-Ins, and Actions on graphics. I am not sure how to add an action based on “connecting to” a shape though, so that part might be a feature request or something you would need to build logic for (to identify which graphics should be clicked to trigger their action when they are connected to).

This is the area in the Properties Inspector where you set up which Action from the Plug-In should be triggered.

It sounds like a cool project idea! Feel free to reach out to us via email (Contact Omni under the Help Menu) if you see any unexpected issues or have requests for capabilities you’d like to script.

I am familiar with the action when tapping on a graphic but not with the “specific magnets and actions on them”. Can you elaborate? i.e., does the action run when a connection to the magnet is made (or a connection is removed)? Code examples anywhere? I have Sal’s but that does not seem to use those magnet actions…

There are not magnet actions, I meant that you can set which magnets are on each graphic in the application in the Connections area of the Properties inspector and reuse those from a stencil file. The actions apply only to the entire graphic. I was hoping you can use magnets and line options in a stencil to limit the paths because the actions apply to the entire graphic.

If you check out it says the magnet dropdown isn’t currently scriptable. That is why may want to set up a stencil, then place a graphic with the magnets and connection settings that you want onto the Canvas to manipulate it.

You have the ability to Copy as JavaScript in the app (Copy As: JavaScript from the Context menu when you have a selection) and paste that code into the console, or whatever IDE you are using to get some examples. Here’s an example of setting the action to run from a plug-in on g1 (graphic):

g1.automationAction = ["com.NyhthawkProductions.OmniGraffle", "addGraphicFromStencil"];

You can script magnets in general, just not the dropdown options, so like this to add a set of magnets to a graphic:

g1.magnets = [new Point(0.00, 1.00), new Point(0.00, -1.00), new Point(1.00, 0.00), new Point(-1.00, 0.00)];

Send us your requests in email so that we have some feedback about what to work on next. It sounds like parts of what you are trying to accomplish are possible, but some may not be.

Greetings! From your description, it seems like you’re looking for a handler that is triggered whenever a graphic is altered.

The scripting API documentation for OmniGraffle (Automation menu > API reference) contains the following:

function onGraphicChanged(handler:PlugIn.Handler) → PlugIn.Handler.Registration or nil
A handler called when any graphic on this canvas changes any properties.

This handler is not implemented a this time, but once it is working, you could assign a script to automatically examine the graphic and respond accordingly.


Thanks @Sal, that function would be great - is there an ETA for this?