I cannot find any action to open the context menu where my cursor is located.
Is there an action in KBM 7 to do so ?
I thought that a workaround would be to simulate a right mouse click, but it does not work.
I am not clear as to how to define cursor location as being wherever my cursor is located.
thanks very much for your time and help
the following does not work
The only reason it's not working is because the action is currently set to always right click on the frontmost window's top left corner rather the cursor location. Just click on "front window's corner" and select "current mouse location" so that the action looks like this:
The macro works perfectly according to my specifications, but my specifications were wrong.
The macro sometimes worked and other times did crazy things, until I realized that what I want is the context menu, of the highlighted note in the Scrivener sidebar. Whether you know Scrivener or not is irrelevant. Basically I would like the context menu of the highlighted item. The cursor could be anywhere on the screen.
Sorry for the confusion.
Does my question make sense?
Use the Click at Found Image action to find the highlight color and right-click on it.
When you take the screenshot of the area you want to click you might want to include a little bit of the right-side boundary overlap to ensure uniqueness.
I'll second @ccstone's suggestion, and I can also provide an example of this kind of found image-based mouse click action that I use in a different app:
The main suggestion I can make that @ccstone didn't already cover is limiting the area where KM searches for found images. If you always keep Scrivener in the same position on your screen, you can use macOS's screenshot tool and/or Keyboard Maestro's own Mouse Display (⌘5 in the KM editor) to find out the coordinates of Scrivener's outline view on your screen, and make sure your found image only looks there. Doing this can improve the found image function's speed and reliability.
I thank you both for your comments.
Unfortunately, I use similar colors (ie blue background) elsewhere in my layout.
There may be something that I don’t understand.
I am dumbfounded: a sophisticated app like KBM can’t just give me access to the context menu ? How is that possible ?
Worst case scenario, instead of resorting to image based clicks which have given me all kinds of problems in the past, is there not a simple keyboard modifier to emulate the mouse right click or 2 finger tap ?
This is why I recommend limiting the found image to a certain area. This way, even if you use the same color elsewhere in your layout, KM won’t get confused because it will only look for the color in the area you specify.
I understand your frustration at not being able to just invoke the context menu on the current selection. I also don’t like to use found images if I can help it, and consider them a last resort, but the fact is, there are apps and circumstances on macOS where they’re really the only viable option; that’s why Peter included them in the first place.
As I’ve said before, I’m far from the most technically savvy user here, so I can’t speak to why KM can’t just provide access to the context menu in the way you, and I’m sure many other users, would like. However, in Scrivener’s case, I can say that not only is it not scriptable, but as far as I can tell, not even its outline GUI can be scripted to allow for a System Events-based right click-equivalent action in this particular section, which is the only other way I can think of to accomplish this particular goal.
If you really don’t want to rely on image based clicks, the last alternative I can think of is to figure out which context menu commands you use most frequently, find out if they are accessible via other, more accessible means (I would guess Scrivener’s copious menu options have equivalents for all or at least most of the commands you use frequently somewhere amongst them) and create your own context menu via a KM palette. Sorry I don’t have a better solution for you; hopefully one of the truly savvy gurus here will have some better ideas.
thanks very much for your reply. I am extremely grateful for and appreciative of the quality of your answer.
I apologize for the tone of my comment, an expression of frustration. Nothing to do with your reply.
I will certainly give your solution a try.
Unfortunately, on the Mac there simply is no way to get the location of the selection in general. I wish there was, but there is not.
Presuming you can get the frame of the window (which you probably can, but I don't have Scrivener to test), then you can use a For Each action to look down the left side of the window for a blue pixel, something like this (untested) :
Keyboard Maestro Actions.kmactions (3.7 KB)
sorry fr the delay.
thank you very much Peter. I will try your solution.
I was able to make this work with perfect reliability on my system by very carefully taking a screenshot of the highlighted area with overlaps above, below, and on the boundary line of the Binder panel.
The only line it won't work on is the very top one — “Start Here” in the tutorial you're showing above.
This is because I've used overlaps upward and downward of the highlight. I'm quite certain that I could get it to work with all items in the Binder panel by more careful pruning of the find-image.
The trick here is NOT to use the highlight by itself — it's to use the highlight and it's boundary colors.
Note — the highlight color changes when toggling between the Binder panel and the Edit panel. This is why the macro starts with the keyboard shortcut to move to the Binder panel.
Right-Click at Selected Side-Bar Item.kmmacros (11 KB)
Spectacular !! Fantastic !! Works like a charm !
Also great idea to add the navigate to Binder shortcut at the beginning of the macro.
That way I can use the macro from within a document or if I am already in the Binder.
You are a genius !
@ccstone @peternlewis @gglick
You probably all know this : it is possible to trigger the context menu with a keyboard shortcut via System Preferences ➤ Accessibility ➤ Mouse +Trackpad ➤ check the Enable Mouse Keys box ➤ type Ctrl-NumericKeypad5 to open context menu. It is a curiosity but not a solution because all kinds of strange things happen with the keyboard (can’t type some letters, like the letter ‘k’)