How to get Google to show the number of results

Google used to show the number of search results by default, but you now have to click the Tools button to display the number. Would it be possible to create a macro with Keyboard Maestro that automatically clicks the Tools button to show search results whenever you carry out a search? Thanks!

Hi @badgerer, you could use Execute JavaScript in Google Chrome action for this.


Thanks Chris. I set up a macro to execute the above when selected from the status menu, but it doesn't appear to work (i.e., nothing happens).

Assuming that you have enabled browser JavaScript from Keyboard Maestro

(see Allow JavaScript from Apple Events)

assistance:Web Browser Automation [Keyboard Maestro Wiki]

then to make sure that the Google Tools button is only clicked if the Tools view is not already expanded, you could use something like:

Expand disclosure triangle to view JS source
const toolsButton = document.getElementById("hdtb-tls");

if ( "false" === toolsButton.getAttribute("aria-expanded") ) {
1 Like

but the Google page still contains the result stats even if the blue Tools button hasn't been clicked, so assuming choice of "Modern Syntax" in the sub-menu of the small chevron to the left of the text field:

Screenshot 2024-06-29 at 12.45.12 PM

another approach is to harvest the report count as a text for Keyboard Maestro to use:

return document.getElementById("result-stats").textContent


Google result count.kmmacros (2.8 KB)

The issue was that I didn't have View > Developer > Allow JavaScript from Apple Events enabled; the macro that ChrisQ suggested now works. Thanks for the tip!

Is there a way to get this this macro to run automatically whenever I make a search on Google?

Hi @badgerer, this macro works for me. You may need to extend the pause time depending on how long google search takes to return results.

So, when you are at the google search page and you type some text to search and then press Enter. The trigger is pressing Enter. Hope that is what you are looking for.

Google Chrome Search Show Results Macro (v11.0.3)

Google Chrome Search Show Results.kmmacros (4.7 KB)


That worked great, thanks!