PURPOSE
This macro provides a method to effectively enter text into a field that is otherwise restricted (e.g., a password confirmation)*. For many of these fields, the Keyboard Maestro action Insert Text by Typing will suffice. However, in cases when the web page or macOS app intercepts the Keyboard Maestro trigger, and/or in cases where the text must be pasted more slowly, this macro can be used.
*When the text is long (e.g., with secure passwords copied from a password manager) this can be particularly aggravating.
MACRO USE
-
Move the focus away from the restricted field (web page or macOS app).
-
Optionally copy a text string into the Clipboard.
-
Trigger this macro; dialog will appear that includes the clipboard text and three macro settings.
-
Optionally modify the text and/or settings: Text to Insert (default = Clipboard); Wait before inserting (in seconds; default = 5); Method (default = Insert text by pasting); Delay between characters (in hundredths of seconds; default = 0). Select Insert Text.
-
During the specified Wait, return the focus to the restricted field and wait for the text to be entered by the macro. The submarine sound will be heard when the text insertion is complete.
SETTINGS
The Wait, Method, and Delay settings are saved for subsequent macro executions; however, the dialog includes are Restart Macro with Default Settings button.
The Text to Insert is not preserved; it always defaults to the value of the Clipboard.
ACKNOWLEDGEMENTS
HTML/JavaScript code within this macro was adapted from: Simplistic Countdown Timer, by @troy. In turn, that code was adapted from Keyboard Maestro Actions that @perternlewis supplied in this post.
TESTED WITH
• Keyboard Maestro 11.0.2
• Sonoma 14.2.1 (23C71)/MacBookPro18,2
• Sonoma 14.2.1 (23C71)/VariableMacBookPro16,1
• Mojave 10.14.16/Macmini6,2
• High Sierra 10.13.6/iMac11,1445
VERSION HISTORY
( expand / collapse )
1.0 - Initial version
1.1 - Fixed typographical errors in this comment. No functional changes to the macro.
1.2 - Changed the timer (i.e., custom HTLM Prompt) to deselect Asynchronously.
2.0
a) Enhanced the timer: i) improved appearance, and ii) added Cancel, Reset and Restart buttons.
b) Improved the instructions in the initial dialog.
c) Moved the persistant values from individual global variables to a dictionary.
3.0
a) Changed the name from Paste Into Restricted Field to Insert Text Into Restricted Field.
b) Added the Method setting and corresponding logic.
c) Deleted the secondary trigger and added the Restart Macro with Default Settings button.
d) Improved the timer JavaScript by making the code more readable. Also, the timer is now centered.
e) Updated the dialog to indicate the number of lines in the clipboard (if greater than 1).
f) Settings have been moved to the top of the macro; dialog adjusted to properly display these values.
Download: Insert Text Into Restricted Field.kmmacros (50 KB)
Macro-Notes
- Macros are always disabled when imported into the Keyboard Maestro Editor.
- The user must ensure the macro is enabled.
- The user must also ensure the macro's parent macro-group is enabled.
System Information
- macOS 14.2.1 (23C71)
- Keyboard Maestro v11.0.2