If I run the following from Terminal
osascript -e 'tell application "System Events" to get UI elements enabled'
I get "true" or "false" as expected
But if I were to create a file with the following contents;
#!/usr/bin/osascript
on supportsAssistiveDevices()
tell application "System Events"
set isEnabled to UI elements enabled
return isEnabled as boolean
end tell
end supportsAssistiveDevices
log supportsAssistiveDevices()
and run it via ./myfile
, I get the following error;
./hasguiscript:87:106: execution error: An error of type -10810 has occurred. (-10810)
Can anyone help shed some light on why that might be?
Thanks.