Under Mojave, some of my scripts have begun asking for access to my Contacts and Photos, after asking permission to access the Finder, Osacript, and System Events. I’ve written in the parts that use the Finder, Osascript, and System Events, but I can’t figure out why I’m asking for access to Contacts and Photos. (The same request happens if I run a script from SD, but then I’m told that SD wants access to those things.)
Now that I’ve said No to those requests, I can’t figure out what’s triggering them. Has anyone else experienced this and has anyone else any insight on how to prevent it?
This seems to happen when my script opens a Choose File dialog in the home folder, and that folder of course includes Photos and Contacts. Probably there’s no way around this, but I wish there could be one.
You can step through your code in Script Debugger and hopefully identify the command(s) that are leading to the Contacts and Photos access permissions. From there, if the problem isn’t obvious, perhaps you an post the relevant code snippet and we can offer suggestions.
A common mistake is to embed scripting addition commands, such as choose file name, within tell application blocks. This causes the target application to become part of the AppleEvent and for permission to be obtained when it isn’t really needed.
Thanks for this. I’ll try it on another machine where I haven’t already said No to the prompts. My only ‘choose file’ command stands on its own, not in a block. I’ll report if I find anything useful.
Oddly enough, when I reset permissions, I get prompts to grant permission to run the Finder and System Events, but this time it doesn’t ask for access to Contacts and Photos. I’ll keep trying…