How to navigate google docs menus?

Hello,

I recently rediscovered google docs after ignoring it for many years. It has evolved a lot and I am impressed at how everything is URL based. There are links to all folders, documents, headers, bookmarks etc which certainly cannot be said about MS Word or Pages. No syncing problem / conflicts between devices. Very easy to collaborate - share documents.

My only problem is that I don’t have the usual KM approach to navigating menus. There are some native Keyboard Shortcuts but they are limited, so I am stuck using the basic native Keyboard Shortcuts followed basic KM macros to navigate using by a multitude or :up_arrow::down_arrow::left_arrow: → , more or less reliable image recognition etc

thank you very much !

You're using a web app, so those aren't real macOS menus, which explains why those functions don't work. You might try the "Press a button" function, or you may have to see if they're identifiable as separate HTML items you can reference via Javascript.

There are upsides to using web apps, and there are downsides to using web apps; you'll have to decide if the tradeoffs are worth it.

-rob.

1 Like

thank you very much

would you have a reference ? thank you

The easiest way to tackle this is to feed the page (source or URL) to an AI, and say something like "I want to activate item Bar in menu Foo using Javascript, can I do that?"

It will then hopefully return a line of Javascript that you can test in Keyboard Maestro's Javascript in Front Browser (or Chrome or Safari) action.

-rob.

1 Like

Thank you. I tried exactly that multiple times and each time AI (Gemini) failed. I will continue trying, this time with buttons.

I spent a bit of time with Claude, asking it about this. In short, the answer appears to be:

Got it. Since a real mouse click works but synthetic ones don't, Google Docs is likely checking isTrusted on the event — synthetic events always have isTrusted: false and Docs probably ignores them for security.

Basically, Google is preventing outside scripting of the menus, at least based on Claude's work. You can read my whole transcript; there are some bits of Javascript in there that return the proper menu items, but they are impossible to activate.

Claude thinks you'll have to use clicks at found images to automate these actions.

-rob.

1 Like

I’ve spent some time hacking macros for Google Slides which has similar challenges. One workaround that may prove useful is to use Google Docs’ ‘Search the menus’ function via KM. Make a shortcut that starts with the relevant keystroke to trigger the Docs menu search (Option+/ on a Mac). Once that’s activated, you can use KM to instantly type text for the command you want to trigger into the text field that appears, followed by return, thus triggering the Docs menu command you want. It takes slightly more time than a direct shortcut, but it works (mostly!).

1 Like

thank you @griffman and @jbtokyo for your replies and thank you @griffman for the Claude discussion.

After trying different approaches, I have come to the conclusion that the huge number of google docs native shortcuts are extremely easy to trigger and cover nearly all menu items (the full hierarchy). I simply have a floating palette when I am working in GDocs and click on macros in the palette as needed (I could use a Keyboard Shortcut to trigger the macros).

The macros are basic, ie a sequence of keypresses, for example Ctrl Opt O (format) → t (list) →b (for bullet list) etc. It’s extremely fast and effective, and more reliable than image searches and mouse clicks.

1 Like

I tried that at the beginning but grew tired of having to type in the menu item

Glad you found a solution that works! Just to clarify in case my original post wasn’t explicit — I include the Google menu command inside the KM macro (see attached screenshot) so it only needs typing once when you set up the macro. After that, no need to type anything more than the trigger hot key:

1 Like

I misunderstood your original post. Your approach is very intelligent and much better than mine. I will change all my macros accordingly. I am trying to find a quick way to do so. Where did you copy the list of sub menu commands from ? example: "Centre on page: Vertically" below

also: do you use extensions ? which ones ?

Unfortunately, I didn’t have a list of menu commands to copy. I tried typing text into the search field and made a note of what Google Slides auto-complete showed. So for example, I typed ‘Centre’ and took a screenshot of all the results, then typed those into KM.

But be warned: In Slides, the auto-complete results are contextual. It only shows suggestions for actions that could be performed (based on what object is currently selected), so you won’t get a full list of potential actions by default. For example the suggestions might be different if you select a shape, vs if you select some text. So it needs a little investigation to find all the possible commands.

It took a little time to set up, but once it’s finished, it’s a pretty good system. I don’t use any extensions for this.

1 Like

GDocs Submenus names and Keyboard Shortcut.pdf.zip (278.7 KB)

Keyboard shortcuts for Google Docs - Computer - Google Docs Editors Help