Securely Store Credit Card Number for Pasting in Web Site Fields


I have found information on use of Keychain Access passwords in KM, but I haven’t found a way to encrypt and store a password or credit card number in KM and have a macro paste the decrypted number into a website field. Do I need to make keychain entries for my passwords and credit card numbers to make this work?


Use the Set Keychain Password to Text action to set the password into the Keychain.

Use the Set Variable to Keychain Password action to read the password from the Keychain.

Remember to delete the value in the Variable after you are done with it.

Name the variable “Password whatever” so that Keyboard Maestro knows it is a password and will not write it to disk with the rest of the variables (see the Variables section)

The passwords are encrypted in the Keychain and only available while the Keychain is unlocked.


While you can do this with KM, I’d highly recommend a password manager like 1Password, which is much more secure and reliable, and can also sync across multiple devices.


Absolutely. There are occasional uses for secure passwords stored for use with Keyboard Maestro, but for general passwords, a tool like 1Password or the like is definitely the way to go.


I’d second (third?) this suggestion; 1PW is the most reliable macOS/iOS password manager around. “It just works.”


I’m glad that 1Password works. I use LastPass for my web browsers.
Occasionally, a web site isn¹t built right, and LastPass can¹t enter secure
data into a field. Having an alternate secure method is useful. QuicKeys
provides that, and I hoped Keyboard Maestro could, since QuicKeys is
orphaned software with more problems with each OS X update and upgrade. For
the secure data issue, I¹ll need to use AppleScript to hold and send my
encrypted data. KM will just be the trigger.

I¹m new to KM. I¹m converting my most important QK Shortcuts to KM macros.
Unfortunately, I¹ve had to use AppleScript more than I like to make up for
what KM cannot do. In some cases it¹s easier to just write an applet. KM has
hundreds of actions. I need about 30 types of actions. I was hoping for 90%
overlap. It looks like only 70% overlap. It might be 80% if I become a super
master of KM, but I¹m not interested enough to spend hundreds of hours to
become a master.


I have not found any web sites that do not work with 1Password.

Unless you have some highly complicated tasks to automate, it is unlikely that you will need to “spend hundreds of hours to
become a master” of Keyboard Maestro. If you reach an impasse trying to write a KM macro, before you spends hours, or switch to AppleScript, you might want to post a question here stating your objective, and what the impasse/issue is. I’m pretty sure you’ll get some quick help.

Having said that, there are a few things better done in a script. For example, choosing a file/folder. KM currently does not have a native Action for that function. But it is highly likely that one or more of us veteran KM users have already developed a script for that, which we are happy to share. So, unless you just want to write the script yourself, you can always post a question asking if someone has already done so. OR, of course, you can search the “Macro Library” which contains both macros and scripts.

So, feel free to post a question here if you hit a roadblock.



Peter sent me to this thread months ago, and I’m afraid that I’m not savvy enough with KM to be able to decipher his original response to GregT’s question. Could someone please write out an example of how a macro that can paste a password out of my keychain would look?

Many thanks in advance,


Hi John,

Here you go. Just replace the "Password Name" text in the field marked "to Keychain password named" with the appropriate name of the password you want to use from your keychain.

Paste Password from Keychain.kmactions (817 Bytes)
28 PM


Thanks, Gabe! This is a huge help. I’m much obliged. :+1:t3: