I’ve started exploring the (tantalizing) Omni Automation site… I’d eventually like to insert a shape and open a text box for entry at the current cursor position using a keyboard shortcut or Keyboard Maestro macro.
Question for the moment: in Sal’s sample scripts (addBlueCircle.js), the new graphics is placed using
aRect = new Rect(100, 100, 200, 200)
How could I modify the script to place the graphic at the current cursor position?
and the missing part of the omniJS puzzle at the moment, is that it doesn’t yet have the ability to place a shape in the clipboard (probably an easier technical feat, for the moment, than reading the system cursor position and translating it into a canvas coordinate, though either would be good).
It would be worth a quick note to Omni Support through OmniGraffle > Help > Contact Omni to describe that use case, which makes a lot of sense, I think.
At the moment, as far as I can see, you would still need two steps:
Manually copying a shape created (perhaps by script) with the style and size that you need,
Using Keyboard Maestro to click and paste at the mouse position in response to some hot key or other trigger
Thanks for the info and suggestion. Here’s what I tried just now, and it looks promising:
(OG automation) have a menu script that pastes an object at a specific point (and leaves it selected)
(keyboard maestro) hotkey deselects anything that’s selected (esc), executes the OG plugin script, cuts the object (command-X), clicks at current (hopefully empty!) canvas position where the cursor is sitting, and pastes (command-V), which should appear at the cursor position