Logging in to services via Keyboard Maestro?

How can I use Keyboard Maestro (and 1Password) to log in into Fastmail in Fastmate?

I use Fastmate instead of a browser for Fastmail. As a result, I cannot use 1Password’s AutoFill feature to log in. Currently I use 1Password Mini and have to swap 3x between Fastmate and 1Password to fill in these details:

  1. Username
  2. Password
  3. OTP code

I was hoping to automate this using Keyboard Maestro (v9) but I fail to do so…

Somehow 1Password/KM9 fails to handle 3 Copy actions in a row? Only 2 seem to work (most often: username and OTP code, but not password)

Who can help me to get this to work?

This is what I currently try:

  • Type ⌥⌘\ keystroke to open 1Password Mini
  • Pause until OCR sees “Generate Password” on main screen
  • Simulate keystroke (“Forward Delete”) to clear 1Password Mini’s input field
  • Insert text “Fastmail” (by typing)
  • Pause until OCR sees "@fastmail.com" (part of username)
  • Simulate keystroke “Tab”
  • Simulate keystroke ^C to copy the username
  • Set the value of the clipboard in variable Username
  • Type ⌥⌘\ keystroke to open 1Password Mini
  • Simulate keystroke ↑⌘C to copy the password
  • Set the value of the clipboard in variable Password
  • Type ⌥⌘\ keystroke to open 1Password Mini
  • Simulate keystroke ↑^⌘C to copy the OTP code
  • Set the value of the clipboard in variable OTP
  • Activate the app Fastmate
  • Insert the variable Username (by pasting)
  • Simulate keystroke “Tab”
  • Insert the variable Password (by pasting)
  • Simulate keystroke
  • Insert the variable OTP (by pasting)
  • Simulate keystroke

How can I get this to work?

(And how can I present a nice graphical representation of my flow; does KM offer that?)

Select your actions and then under the “Edit” menu there’s copy as image. Just bear in mind that it’s hard to read on mobile and there are several users who have visual impairments on this forum - text is much easier to read than an image (especially for screen readers):wink:

1 Like

Thank you! Learned something new today :slight_smile:

While debugging this I noticed that the fans of my MacBook Pro are working very hard, as is the CPU (Keyboard Maestro engine using most of the cycles)…

Is that a bug in OCR/Debugging in KM9?

Timing is everything…

After adding a lot of (OCR) actions to verify that a screen (element) is actually present before interacting with it the macro (finally) started to work!

While it’s cool to use the v9 OCR function (to feel right about upgrading), is there a better way than OCR to check this?

What happens if you use the normal 1p app window and add a 1 / 1,5 second pause between copy action 2 and 3?

something like:

  • activate application 1Password
  • Simulate keystroke (“Forward Delete”) to clear 1Password input field
  • Pause until OCR sees "@fastmail.com" (part of username)
  • Simulate keystroke “Tab”
  • Simulate keystroke ^C to copy the username
  • Set the value of the clipboard in variable Username
  • pause 1 second
  • Simulate keystroke ↑⌘C to copy the password
  • Set the value of the clipboard in variable Password
  • pause 1 second
  • Simulate keystroke ↑^⌘C to copy the OTP code
  • Set the value of the clipboard in variable OTP
  • pause 1 second
  • Hide application 1Password
  • Activate the app Fastmail
  • Insert the variable Username (by pasting)
  • Simulate keystroke “Tab”
  • Insert the variable Password (by pasting)
  • Simulate keystroke
  • Insert the variable OTP (by pasting)
  • Simulate keystroke
  • Clear the clipboard

I’m afraid that’s still slower than when I do it manually…

(as is my current solution)

Even if you skip the first 2 pauses and only use the third?

I thought about it a bit more, and I’d consider removing the OCR and use the “find image on screen”, as it seems less processor intensive.

Got the same suggestion on the Keyboard Maestro forum.

Will experiment with that later this week.