Live data from Hacker News

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

github.com

11–13 of 13 posts

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

#11
post #10

Earlier quoted context omitted.

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}"

How do you stimulate delays, animation intervals, key down/ups a with System Events?

Apple Script is a programming language and you have full control flow at your disposal to wait and branch as needed.

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

#12
post #11
post #10

Earlier quoted context omitted.

How do you stimulate delays, animation intervals, key down/ups a with System Events?

Apple Script is a programming language and you have full control flow at your disposal to wait and branch as needed.

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)

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

#13
post #10

Earlier quoted context omitted.

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}"

How do you stimulate delays, animation intervals, key down/ups a with System Events?

AppleScript supports the "delay" command. System Events supports both "keydown" and "keyup" in addition to keystroke.
Post reply on HN