Determine if the system is in Secure Input Mode

It might be useful to know if you are currently in Secure Input Mode, which typically happens if you are in a password field (although it could happen for other reasons, such as the Terminals' menu commend which can enable Secure Input Mode, or sometimes the system simply gets stuck in Secure Input Mode).

In any event, you can do this using the API call IsSecureEventInputEnabled(), and you can access this (or many other API calls) via JavaScript for Automation, which you can access via an Execute Shell Script action:

osascript -l JavaScript << END_TEXT

ObjC.bindFunction('IsSecureEventInputEnabled', ['bool', []]);
console.log( $.IsSecureEventInputEnabled() );

END_TEXT

There are lots of other API calls that this technique might be useful with.

2 Likes

Thank you for this!

Q? I am trying to achieve something very similar. I need to know if I am “any input mode”.

My purpose is that I wish to create some macros that disable to the “delete” key under most circumstances.

Would it be possible to modify this statement to achieve this?

Thank you so much!

If you mean “can I currently type in text”, no, there is no good way to know that.

Thank you! I’ll keep working on it.