Skip to main content
Tweeted twitter.com/askdifferent/status/1089221582239748096
added 354 characters in body
Source Link
John Shepard
  • 389
  • 1
  • 3
  • 4

Script:

#!/usr/bin/osascript
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.users"
    delay 2
    tell application "System Events"
        click radio button "Login Items" of tab group 1 of window "Users & Groups" of application process "System Preferences"
    end tell
end tell

How do I provide assistive access to this script? When running this through 'Script Editor', all it it needs is 'Script Editor' to be enabled under 'Accessibility' in 'Security & Privacy'.

But I need to run this (and some other similar script files) to be executed without user's intervention. I've tried saving the file in .sh, .app, .scpt, .applescript formats and run via terminal as sudo without any luck.

I've gone through other questions like this and other without any help.

EDIT: Thanks for the response guys. We've already tried these methods and they work without any doubt and that's where problem lies. We've way too many mac machines to go around and enable on them manually. We were hoping for some command that will add Terminal to the list with user's permission (kind of like UAC in Windows) or if possible silently.

Script:

#!/usr/bin/osascript
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.users"
    delay 2
    tell application "System Events"
        click radio button "Login Items" of tab group 1 of window "Users & Groups" of application process "System Preferences"
    end tell
end tell

How do I provide assistive access to this script? When running this through 'Script Editor', all it it needs is 'Script Editor' to be enabled under 'Accessibility' in 'Security & Privacy'.

But I need to run this (and some other similar script files) to be executed without user's intervention. I've tried saving the file in .sh, .app, .scpt, .applescript formats and run via terminal as sudo without any luck.

I've gone through other questions like this and other without any help.

Script:

#!/usr/bin/osascript
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.users"
    delay 2
    tell application "System Events"
        click radio button "Login Items" of tab group 1 of window "Users & Groups" of application process "System Preferences"
    end tell
end tell

How do I provide assistive access to this script? When running this through 'Script Editor', all it it needs is 'Script Editor' to be enabled under 'Accessibility' in 'Security & Privacy'.

But I need to run this (and some other similar script files) to be executed without user's intervention. I've tried saving the file in .sh, .app, .scpt, .applescript formats and run via terminal as sudo without any luck.

I've gone through other questions like this and other without any help.

EDIT: Thanks for the response guys. We've already tried these methods and they work without any doubt and that's where problem lies. We've way too many mac machines to go around and enable on them manually. We were hoping for some command that will add Terminal to the list with user's permission (kind of like UAC in Windows) or if possible silently.

Source Link
John Shepard
  • 389
  • 1
  • 3
  • 4

osascript is not allowed assistive access. (-1728)

Script:

#!/usr/bin/osascript
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preferences.users"
    delay 2
    tell application "System Events"
        click radio button "Login Items" of tab group 1 of window "Users & Groups" of application process "System Preferences"
    end tell
end tell

How do I provide assistive access to this script? When running this through 'Script Editor', all it it needs is 'Script Editor' to be enabled under 'Accessibility' in 'Security & Privacy'.

But I need to run this (and some other similar script files) to be executed without user's intervention. I've tried saving the file in .sh, .app, .scpt, .applescript formats and run via terminal as sudo without any luck.

I've gone through other questions like this and other without any help.