Problem with hot keys that activate on being pressed

I made a macro to type a text string into a password dialogue and activated by a hot key combination consisting of control keys and an alpha-numeric character. The macro activated on the hot key combination being pressed. However, if the alpha-numeric character in the hot key was the same as one of the characters in the text string the password failed and was one character shorter than it should have been. For example, if the first letter of the string was an A, and the character in the hot key was also an A, the A in the string was not typed. Of course when text is typed into a password dialogue only a string of dots appears. I discovered (in this example) that by manually adding the A at the beginning of the string of dots the password worked. After many tries and head-scratching I discovered the macro would work on the hot key being pressed only if the hot key character was different than any of the characters in the text string. Curiously, if I activated the macro in a document the proper text string was typed. The problem was solved by activating the macro when the troublesome hot key is released. One might be wondering why I would use a macro to type a password but that’s another story.



Yes, this is correct.

See the wiki troubleshooting issue: Sometimes Typing in Password Fields Drops Characters

The only solution is “don’t do that”. Either change your hot key, change your password, or include a Pause and wait until the key is released (which state Keyboard Maestro cannot detect anyway because you are in a password field).