How best to detect that 1Password Mini is opened/closed?


What's the best way to detect that 1Password Mini is opened/closed?

I'm currently using KM9's OCR functionality and the presence/absence of 1Password Mini's "Generate Password" button on screen:


This works, but it feels a bit slow, especially since I have to run it 3x for copying username, password, and OTP code from 1Password Mini for one account (so that I can use those values later to let KM "type" them in an App, where I can't use 1Password's AutoFill functionality).

How can I improve the performance?

Do you realize what a huge security risk you are taking by doing this?
The whole purpose of 1PW is to protect your login credentials.

I thought that @peternlewis had planned to provide 1Password 7 Search Action in KM9, but it appears he did not.

IAC, rather than 1PW, you can use the security of your macOS Keychain to fill in the Mac App login windows. With this method, your password is unprotected for less than 0.5 sec. So you can decided if that is good enough security for your needs.

See this macro I just posted:

MACRO: Use macOS Keychain to Get Password for Mac App [Example]

I'm not sure what you are trying to do, (JM may be right about security) but with regard to your performance question, in my experience OCR actions are about 100x slower than Find Image actions.

I'm not sure; I see these risks:

  • Automatically "Typing" the intended password in a wrong field; "leaking" that password (for an account with 2FA)
  • Automatically "Typing" the wrong password (because account selection failed); "leaking" a different password (possible for an account without 2FA).

Is that what you are referring to? Or something completely else? (If I have a blind spot, please tell me)

Maybe I should have given a little more context?

I use Fastmate instead of a browser for Fastmail . As a result, I cannot use 1Password’s AutoFill feature to log in. What I currently do in the morning is start a lot of Apps via KM. The last App is 1Password. I then type in my master password and flip 3x between 1Password and Fastmate to fill in username, password, and OTP. I'm trying to automate the latter part (after manually typing in my master password; I'm not automating that).

But it's a good point that you made anyway. I should re-consider whether its safer to stay logged in in Fastmate all the time (than trying to automate logging in).

Ah, I should experiment with this (later this week).

I don't use this extension @rob. What does the login process look like with Fastmate?
Do you start the extension like an app? Is there an input window for the login?
Could you make me some screenshots. Maybe I can help you to automate this with 1Password.

Fastmate is a native wrapper for Fastmail on macOS (it's an App, not an extension).

"Your Fastmail login and e-mail are handled entirely by WKWebView, meaning that it is pretty much the same as running Fastmail in Safari."

So the login flow is identical to the browser flow, with the exception that 1Password AutoFill cannot be used.

That number, 100x, was just my estimate from personal experience. But OCR and Find Image have one thing in common: they make mistakes. The ways of dealing with the mistakes using programming are very different. In that regard, I think OCR has an advantage because it's easy to use KM's great text facilities to tell if the search was a false positive or a real positive.

For example if I'm using OCR to read the screen, and I'm looking for a word, and I know that word is a month of the year, it's not too hard to check what month-word it was, even if the OCR misspelled it. (E.g., "July" might come back as "JUIy" (two mistakes there.)) That's why I have a lot of experience with "string comparison/approximation" routines. But with Find Image, searching for a month name in a bitmap is a very unforgiving process. The only approximation method in the Find Image routine is the Fuzziness slide bar, and sadly that's a constant in KM, not a variable, so you pretty much need self-modifying code in KM to make that work effectively.

There is also no 1Password Autofill function for the login in the Mac Appstore @rob, but it only works with one mouse click :wink:

Look here at the beginning of the video:

The Messenger Threema does not have its own Mac App. So I would always have to use my browser to access the website.
With Unite (A full web browser...
now with WebKit 2) I have created such a website for myself. Also here the KM 1Password autofill login works with starting the app:


Here is the macro for it, it does the same steps as with the manual insertion of the login. Just a little faster.
It also has the advantage that the copied password from 1Password is immediately deleted from the clipboard. Not even 1Password can do that:

Threema Web.kmmacros (105,2 KB)

I have deactivated the action marked in red. I use the App Pushover to get information about the login process at any time.

Now you know why I asked for screenshots.

1 Like

Thank you for the example.

You gave me some new techniques to experiment with:

  • Use a URL scheme
  • Just wait a short time instead of OCR or image recognition
  • Use AppleScript

Update: using the URL scheme (in KM, not with AppleScript) and waiting 0.2 seconds instead of OCR makes the macro much faster! Pretty pleased with the result so far (there might be room for improvement)

1 Like