I have this script:
#!/usr/bin/env osascript
activate application "SystemUIServer"
tell application "System Events"
tell process "SystemUIServer" to keystroke "q" using {command down, control down}
end tell
It needs assistive access. It seems I have to enable this access for the whole terminal application (iTerm2 in my case) to get it to work. This seems like giving a lot of privilege to iTerm. What are the security implications? Is there a workaround?