Move and click mouse relative to mouse location?

I'm trying to figure out out to move and click relative to the current mouse location. I need to right click to bring up a menu then scroll down to choose a menu item. (I can't use Select or Show a Menu Item in this case because the menu is only available when you right click). I can't figure out how to get the relative distance into the command. I can do it for Absolute position and the Get button but I don't see how to do it for Relative to mouse location. Any thoughts?

Hi @bf656.

There's a much simpler way to do what you're trying: after right-clicking, just type the first few characters of the menu item followed by return, and the menu item will effectively be "clicked".

Here's an example where, when my pointer is over an item in Finder, the macro automatically brings up the view options from the context menu.

KM 0 2021-08-20_15-09-38

Macro code:
Test Context Menu.kmmacros (2.7 KB)

The duration of the Pause action can be tweaked, depending on your own system's performance.

Hope that helps.

I agree with tiffle, if you did want to click relative to mouse position though, when you choose the 'Move and Click' action, there's an option there for Relative to Current Mouse Location.

I tried a couple of things but neither worked.

Damoeire,
I know about the option for Relative to Current Mouse Position, but I can’t figure out out to use it. I can’t figure out how to get any values into the boxes that would move the mouse. I see how to do it with Absolute, you click on Get then move the cursor to where you want it and the numbers show up in those boxes. I don’t see how to do it in Relative to Current Mouse Location.

Tiffle, it seems I can manually execute your macro in a Mac window but it doesn’t work in an Avid window. When I right click the menu pops up but when I type, nothing happens. (I’m working in Avid Media Composer).

Hmm. Maybe I'm missing something that you need to do, but this works for me (of course you'd need to change the coordinates). I also tested it with a right click action, and that worked as well.

Is that what you tried and it didn't work?

Move or Click Mouse Action (v9.2)

Move or Click Mouse.kmactions (974 B)

Those two macros you showed above are the ones using the technique I described, so are they the ones you say

I don't have Avid, so I can't test this myself. But an easy way to see if what I suggested will work is to use the actual mouse and keyboard on your Mac to do the right click and then type to see if the menu item actually gets selected.

I understand that I can manually enter numbers to move the cursor, but is that the only way to get those coordinates in there? Enter some numbers, see if they work then adjust and try again?
If I choose Absolute I can click on Get then simply move the cursor and the coordinates will appear in the boxes, I was hoping something like that would work for the Relative option.

Yes I did that. I Right clicked but when I typed nothing happened. (in Avid). It worked just fine in Mac.

Aah. I see. You could use Cmd-Shift-4 to get the original mouse position, and then do it again to get the new mouse position, then do the maths to get the relative difference. I don't know anyway using the 'get' because usually right click menus disappear when you leave the window, or at least some do. Presuming you don't have too many to do, it's a relatively quick process, you start to get an idea of the distances after a while. But if you had a lot to do, I can see it would be a hassle! Good luck!

Sounds like perhaps Avid is doing something outside the usual Apple guidelines that prevents it from working? It could be that since AMC is multi-platform, the toolkit used to build it has its own way of supporting user interface stuff, like menus for example. I thought I'd try the free trial so play with it myself, but I'm not prepared to create an account with Avid just for that! Sorry.

I know that @Damoeire's approach will work if you can sort out the relative positioning. I've used this technique many times in the past and I've always had to revert to trial and error to get the relative positioning bit right.

Just a thought. You might already have done this, but try searching this forum for Avid Media Composer - you might dig something useful up!

Thank you both.
I did as you suggested Damoeire, entered the numbers manually and it worked no problem the first time.

Unfortunately the Select Menu command doesn't work in Avid for contextual menus. Too bad, it would make things a lot easier.

Thank you both again very much.

1 Like