Heads up on a bug in the keystroke command:
If there is a Unicode “narrow no-break space” (8239) in a string, and you use keystroke to type that string somewhere (tested in Terminal and TextEdit, so probably anywhere), that character gets replaced by the character “a”.
Here is sample code to replicate this:
set myString to "Screen Recording 2025-12-16 at 5.54.04 PM.mov"
tell application "TextEdit"
activate
make new document
delay 0.5
end tell
-- Type in the string:
tell application "System Events"
keystroke myString
delay 0.5
end tell
When I run this, the end of the file name is “5.54.04aPM.mov” (notice the extraneous “a”), instead of “5.54.04 PM.mov”.
That’s because apparently macOS saves the “time” in the names of screen shots and screen recordings using a non-breaking space before the AM/PM.
Anyone know why keystroke is unable to type that perfectly-valid-if-sneaky Unicode character?
I can set the clipboard and then paste, but I’d love to avoid modifying the clipboard, if possible.