Sendkeys: Command line tool for automating keystrokes and mouse events on macOS

30 points by nateb2022 1 day ago | 11 comments
  • supersixirene 19 hours ago
    This is legend. I’ll be putting this to extensive use tomorrow.
    • robterrell 17 hours ago
      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 13 hours ago
        How do you stimulate delays, animation intervals, key down/ups a with System Events?
        • bestham 10 hours ago
          Apple Script is a programming language and you have full control flow at your disposal to wait and branch as needed.
    • pkoird 13 hours ago
      Wonder how this compares to Autohotkey on Windows.
      • eviks 13 hours ago
        Ahk isn't cli, and also is a full-blown programming language, so not as limited in its input
      • biomcgary 13 hours ago
        Now to finetune my local LLM on the sendkeys syntax, add kyutai for streaming voice recognition, and my mac will be fully voice operable.
        • lukaslukas 20 hours ago
          Nice. But why?
          • ivanche 19 hours ago
            For example to automate what couldn't be automated otherwise.
            • supersixirene 19 hours ago
              For example to deal with software designers that think web browsers are people