AppleScript & "System Events" keystroke sometimes doesn't work
- iTerm2 version: Build 3.0.git.2b2f92ba (w/ this patch)
- OS version: macOS 10.11.6
- com.googlecode.iterm2.plist: https://github.com/alexfedoseev/dotfiles/blob/master/.iterm/prefs/com.googlecode.iterm2.plist
What happened: I use AppleScript API to scaffold projects layouts. One of the steps is:
tell application "System Events" to keystroke "k" using command down
Sometimes it works as expected (clears screen). But sometimes instead of clearing the screen it just selects everything in term window (so it's like semitransparent overlay over the term window).
Here is the video of process: https://cl.ly/hdYA (toggle full screen) Or same but as gif: https://cl.ly/hczR
And here is applescript for this layout: https://github.com/alexfedoseev/dotfiles/blob/master/.alfred/layouts/2-rows--large--1%2B1.applescript
What should have happened:
It should clear the screen (same as on Cmd+K
).