Move mouse to a menu item in a context menu

hello there,

i am just thinking about a workflow in protools. i would like to automatically enter a context menu and move my mouse cursor to a specific menu item in a submenu.
manually i would right click on a specific audio clip to access the context menu. from there i would move the cursor to its 10th menu item to access a submenu and then choose a specific audio channel from the list. here is how it looks like:

Screen Shot 2020-03-04 at 15.19.55

so far i have the following. this just moves the selection but not mouse cursor to the right spot in the menu.
any ideas how to move the mouse cursor to that spot? thanks!

Screen Shot 2020-03-04 at 15.24.01

or as macrofile:

select channel.kmmacros (4.9 KB)

Clicking with mouse position is always a bit tricky. I would have a look if this function is also available in the status menu.

thanks, what exactly do you mean with status menu?
it i not possible to access this function via a programm menubar on th top of th screen… if that is what you had in mind.
i used uibrowser to get the name of this context menu. but the menu name was unknown?.?.
it looked something like this:
menu: "" (-8273929877389750)

If you want to select that item, there is no need to move the mouse cursor to there. Once it is highlighted as you have it, you just need to hit the return key. So, you could add one more step to your macro: Simulate Keystroke "Return".

right, i forgot to mention that i want to spot the mouse cursor at a default postion in the submenu. so i can quickly choose from this list of channels/audiofiles by using the mouse (the list of audiochannels will change depending on which sndfile i right click). moving down this list via arrow down, up and select a channel by return, means that i need to switch from mouse to keyboard with my right hand … thats the reason why i want to move the cursor to the submenu so i can stick with the mouse.

hope its more clear now. thanks for your help.

here is screeshot of what uibrowser returns when i spot the cursor to the submenu item "expand chennels to new track":

and if it helps this is what uibrowser returns when i spot the cursor on the first channel in the submenu:

As you can see "position" is a property of the element you have selected.
So, in theory, you could run an AppleScript after the context menu appears, get the element, and it's position. Then use that position to move the mouse with a KM "Move Mouse" action.

I have used this technique with other popup elements, but not this one. So, it is just an untested theory.

Good luck, and let us know how it goes.

So, character-based navigation of the menus isn't working for you?

thanks for all the feedback. that helps a lot.
@JMichaelTX if i understand you, you recomment to navigate to the submenu (via my km macro) than ask with an applescript for the coordinates of that item, that i store in a variable and use it to set the new cursor position (via km again). right?

@appleianer nice. will look into that if i cant figure it out with applescript. thanks!

@MartinPacker what do you mean by that? by typing the items name directly?

Sometimes, once in a menu you can navigate it with keystrokes. It's worth exploring if you can do it in this case, rather than using a rather unreliable mousing around method.

Then automate.

Yes, that's my untested suggestion. No guarantees. :wink:

The OP, @Johannes, has stated he wants to avoid using the KB since his hand is on the mouse at the time.

Your idea of type-select does generally work.