Macro Authors: Over the last several months I've created many macros like this with dialogs rendered using the Prompt For User Input action. It’s an amazingly versatile action.
Prior to this macro I've used a global variable to save each of the relevant dialog settings. This approach has worked quite nicely, but the downside has been that the global variable list (seen using the KM Preferences) gets cluttered with these relatively trivial variables.
With this macro I’ve taken a different approach: save all macro dialog settings to a single KM dictionary. See the IMPLEMENTATION NOTE below for more information.
If you are interested in this approach and/or some other dialog box tips, please join this thread: Dialog with Dynamic Popup List
PURPOSE
The purpose of this macro is to generate a complex password. The text value is written to the System Clipboard. The length and components of the password are specified via a single dialog box.
Note: I know there are many ways to generate passwords (including using several other macros within the Keyboard Maestro forum). I’m adding this to the mix. It allows me to very quickly create a long, complex password without leaving the keyboard.
IMPLEMENTATION NOTE
All Generate Password dialog box settings are saved to a single KM Dictionary named jsGP2_dict, where js are my initials and GP2 refers to the name of this macro, version 2. For more information about this dialog box approach, refer to Dialog with Dynamic Popup List.
ACKNOWLEDGEMENTS
The components of the password are randomly scrambled using a Bash shell script obtained here: Bash- scramble characters contained in a string - Stack Overflow
TESTED WITH
- Keyboard Maestro, v10.0.2
- Monterey, v12.2/MacBookPro16,1
- Mojave 10.14.16/Macmini6,2
- High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
1.0 initial version
2.0 Simplified the dialog and changed the underlying logic to match.
2.1 No change to macro functionality. Corrected the macro name in the IMPLEMENTATION NOTE section of this comment.
2.2 No change to macro functionality. Defined local_DICT and used it rather than hard-codng dictionary name throughout.
DOWNLOAD Macro File:
Generate Password.kmmacros (77 KB)
Note: This macro was uploaded in a DISABLED state. It must be ENABLED before it can be run. If it does not trigger, the macro group might also need to be ENABLED.