Skip to content

Instantly share code, notes, and snippets.

@dexterleng
Created October 12, 2019 15:56
Show Gist options
  • Save dexterleng/28b235f8719da80fe7cffd19115e9a7a to your computer and use it in GitHub Desktop.
Save dexterleng/28b235f8719da80fe7cffd19115e9a7a to your computer and use it in GitHub Desktop.
Grant accessibility permissions AppleScript
tell application "System Events"
tell its application process "System Preferences"
tell its window "Security & Privacy"
tell its tab group
tell its group 1
tell its scroll area 1
tell its table 1
set theRows to rows
set numRows to count of rows
repeat with i from 1 to numRows
tell its row i
set c to item 0 of its UI element
set appName to value of attribute "AXValue" of static text 1 of c
if appName is equal to "Vimac.app" then
click checkbox of c
click checkbox of c
end if
end tell
end repeat
end tell
end tell
end tell
end tell
end tell
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment