Skip to content

Instantly share code, notes, and snippets.

@creachadair
Last active December 11, 2022 23:42
Show Gist options
  • Save creachadair/3535d7df5a07cd03dc8db77a30030ac9 to your computer and use it in GitHub Desktop.
Save creachadair/3535d7df5a07cd03dc8db77a30030ac9 to your computer and use it in GitHub Desktop.
Inserting text at cursor on macOS

Insert Text at Cursor on macOS

Requirement: Enable Accessibility for the Terminal application.

tell application "System Events"
   keystroke "text to be inserted\n"
end tell
@creachadair
Copy link
Author

Also supported:

  • keystroke tab: Press the tab key.
  • keystroke return: Press the return key.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment