←back to thread

30 points nateb2022 | 2 comments | | HN request time: 0.428s | source
Show context
supersixirene ◴[] No.44483781[source]
This is legend. I’ll be putting this to extensive use tomorrow.
replies(1): >>44484747 #
robterrell ◴[] No.44484747[source]
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}"
replies(1): >>44486334 #
eviks ◴[] No.44486334[source]
How do you stimulate delays, animation intervals, key down/ups a with System Events?
replies(1): >>44487231 #
1. bestham ◴[] No.44487231[source]
Apple Script is a programming language and you have full control flow at your disposal to wait and branch as needed.
replies(1): >>44487294 #
2. eviks ◴[] No.44487294[source]
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)