Top
Best
New

Posted by nateb2022 7/6/2025

Sendkeys: Command line tool for automating keystrokes and mouse events on macOS(github.com)
32 points | 12 comments
supersixirene 7/6/2025|
This is legend. I’ll be putting this to extensive use tomorrow.
robterrell 7/6/2025|
You've always had this ability, but with more convoluted syntax:

  osascript -e "tell application \"System Events\" to keystroke \"whatever\""
Specify the application too with multiple -e parameters. This will copy whatever is selected in Safari:

  osascript -e "tell application \"Safari\" to activate" -e "tell application \"System Events\" to keystroke \"c\" using {command down}"
eviks 7/7/2025||
How do you stimulate delays, animation intervals, key down/ups a with System Events?
robterrell 7/7/2025|||
AppleScript supports the "delay" command. System Events supports both "keydown" and "keyup" in addition to keystroke.
bestham 7/7/2025|||
Apple Script is a programming language and you have full control flow at your disposal to wait and branch as needed.
eviks 7/7/2025||
This is too generic to answer this specific question. Key down, for example, is not an inherent property of a programming language.

(and neither is delay precision guarantees, which might be important for some key sequences)

pkoird 7/7/2025||
Wonder how this compares to Autohotkey on Windows.
eviks 7/7/2025|
Ahk isn't cli, and also is a full-blown programming language, so not as limited in its input
lukaslukas 7/6/2025||
Nice. But why?
ivanche 7/6/2025|
For example to automate what couldn't be automated otherwise.
supersixirene 7/6/2025||
For example to deal with software designers that think web browsers are people
biomcgary 7/7/2025|
Now to finetune my local LLM on the sendkeys syntax, add kyutai for streaming voice recognition, and my mac will be fully voice operable.