... but does so seamlessly in Mavericks and Lion. The macro is in the image. The trigger is any active application: whenever the Keychain Access' prompt to enter my Mac user password appears the macro inserts all the required fields for me. In KM 6 and 5 it's buttery smooth. In KM 9 (Mojave) when the application "SecurityAgent" becomes active the macro stalls unless I switch back to KM editor: it then types in the password but halts abruptly, and very often it does nothing at all. I know it's running because it brings "SecurityAgent" to the foreground until I disable the trigger, it's just it stops short of doing the actual tasks.
In case you're wondering what the second AppleScript script is for, it checks for the number of text input fields in the prompt: sometimes those appear for both the password and user name, other time it's only the password.
I know about the security implications in the latest releases of macOS but does that mean there's no workaround to make it work as I want it to?