Paste keystrokes automatically with Apple Automator
20 Dec 2021 - Help improve this postWant to paste a text into some place?
Create an AppleScript with this code:
on run {input, parameters}
delay 5
tell application "System Events"
repeat with charOfInput in (characters of (input as text))
set asciiValue to ASCII number of charOfInput
-- Check if ASCII value is in the range of uppercase letters (65-90)
if asciiValue ≥ 65 and asciiValue ≤ 90 then
key down shift
keystroke charOfInput
key up shift
else
keystroke charOfInput
end if
delay 0.1
end repeat
end tell
return input
end run
I created an app called Paste Keystrokes, the final result can look like this:
App not allowed to send keystrokes
If you get issues like thiis:
The action “Run AppleScript” encountered an error: “System Events got an error: Paste Keystrokes is not allowed to send keystrokes.
- Go to System Preferences > Privacy & Security > Accessibility
- Remove your app if listed there
- Re-add your app to the list
Happy coding! – Found a mistake or a typo? Please submit a PR to my GitHub-repo.