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. It's probably best that this variable isn't used elsewhere in another macro. 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. 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.īut this is no guarantee it will be sufficient for your particular use case. 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. 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. Here's the obligatory screenshot of the macro: 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 Up. So in between pressing and releasing of the hotkey, the macro isn't firing or doing anything. 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. The second objective was to have the macro initiate upon pressing of a hotkey and cease upon releasing of the same hotkey. This is why the scripting portions of the macro are an odd mixture of Apple-cum-JavaScript, which wouldn't be my typical approach. The keypress (⌥) was trickier, so I resorted to straight forward AppleScript, which implements the option-down/up key presses very easily. Pressing and holding a mouse button programmatically is not something I'd down before, but I did it in the end via JavaScript for Automation (JXA). However, this doesn't interfere with our experiment, so we can ignore this. † 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. 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 †. 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. Testing is a little difficult, as I struggled to find similar UI elements of a program that responded in a similar fashion. 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. Left click and hold the mouse until I drop the "" key again.Move the mouse to a part of the program's UI.So what I need is to make all of that happen, when I press a certain key.
0 Comments
Leave a Reply. |