A One Button Web Search Automation on MacOS

Is there a reason you don’t have a single button to do a web search on your Mac?

Use case: you’re writing a paper and need to look something up on the web. You tap a button on your mouse and start typing your search…

Here’s how:

  1. Go to Mission Control and turn on “When switching to an application, switch to a Space with open windows for the application.”
  2. Open Automator and create a new “Quick Action.”
  3. Drag a “Launch Application” action in and set it to “Safari” (or whatever browser you’re using ).
  4. Drag a “Run AppleScript” action in and add the code shown below:

The whole automation will look like this:

Copy the code:

Copy to Clipboard
Note: Adjust the delay as needed. I found that 0.2 works well on my system.

5. Save the automation. Name it something like “Start New Search”.

Now, add a keyboard shortcut for this automation:

6. Go to System Settings > Keyboard > Keyboard Shortcuts > Services > General Find your newly saved automation “Start New Search” and give it a keyboard shortcut. Make it unique like: CTRL+SHIFT+ALT+OPTION+S

7. In this example, we’re then assigning that keyboard shortcut to a mouse button. In this case the Logitech MX Master 3: amzn.to/3vACYse

Note: if you’re in another app, the system will ask for permission to switch. Allow this. You’ll only have to do it once for each app.

And voilà, now you can hit the button no matter where you are (or which desktop) and you’ll switch to your browser and get a new tab waiting for you to type in your search.