Faster text input than "keystroke"?

This question must have been asked before but I couldn’t find anything relevant, only a quicker alternative to keystrokes in the GUI (long lines of text) - #5 by DJ_Bazzie_Wazzie

I want to enter long strings fast in non-scriptable apps (e.g., I want to fill in a form in Firefox by placing the cursor in the first field, enter a string, tab, enter a string, tab etc)?

Something like preparing a string, put it on the clipboard and then paste it would be good enough, but I am of course open to other solutions too, as long as they are faster than key code/keystroke.

FWIW, my immediate response to lagr’s request was to use the macOS Text Replacement feature, but I then noticed his comment about long strings. I checked on my Ventura computer and the macOS Text Replacement feature worked with a replacement string containing 384 words but not with 464 words. Perhaps that’s not enough. Also, when filling in a form with the Text Replacement feature, the user would have to enter the string, a space (to expand the string), and a tab (to move to the next field).

The string is not static, I construct/concatenate the string I want to enter based on certain input variables.

How do you insert a string on the clipboard then?

set myString to "ABC123"
set the clipboard to myString
1 Like

That’s good advice, but all AppleScript questions are welcome here.