Stepping over item number 1. in the list since I don't have access to your program's UI, and also feel it's probably best you manually position the cursor before triggering a macro; I believe I've created a macro that accomplishes the tasks set out by items 2. and 3.
Testing is a little difficult, as I struggled to find similar UI elements of a program that responded in a similar fashion. But thankfully, some of the system menu bar icons do just that: holding down the option key, as you probably know, reveals an alternative menu when clicking on the likes of the Wi-Fi, bluetooth and volume menu bar icons. Moreover, one is free to release the option key (or keep it held), but the mouse button must remain down for the menu to remain visible†.
†small caveat: this is true if it's instantiated via a mouse press, rather than a mouse tap, the latter of which separates the menu's dependency from the mouse button status. However, this doesn't interfere with our experiment, so we can ignore this.
The second objective was to have the macro initiate upon pressing of a hotkey; and cease upon releasing of the same hotkey. In fact, this is an illusion: on pressing of the hotkey, the macro is triggered a first time, which deploys the programmatic mouse/key down events; then the macro terminates, however, the mouse/key down states persist. So in between pressing and releasing of the hotkey, the macro isn't firing or doing anything. It then gets triggered a second time when the hotkey is released, and this sends the signal to change the states of the mouse button and option key to
Here's the obligatory screenshot of the macro:
Mousedown + ⌥.kmmacros (21.4 KB)
The macro is current set to trigger upon depressing of the control (⌃) key, and again upon releasing of it. You can change this, but perhaps test the macro using the current settings to begin with, so if changing the hotkey causes it to respond poorly, you'll know it was due to the choice of hotkey and not the macro itself.
Obviously my testing has been limited, basically to this:
Here, I'm attempting to demonstrate the macro in action, which is difficult to do without relying on your faith that I'm not simply pressing and clicking the mouse button myself. In fact, my Keyboard Maestro menu bar icon is the
𝑥 symbol directly to the right of the volume icon, and it flashes whenever a macro is triggered. The menu that pops up is, indeed, the menu one gets when option-clicking-and-holding the left mouse button, and it vanishes once the mouse button is released.
But this is no guarantee it will be sufficient for your particular use case.
On a final note, I've selected a variable called
bool that is used to determine which action to take each time the macro is fired. It's probably best that this variable isn't used elsewhere in another macro. It won't cause too much trouble if it is; but the initial run of the macro relies on the value of
bool being anything other than
true (including unset), so if it were
true from the start, it would simply do nothing until the macro is triggered again. A minor inconvenience, but worth highlighting.