Under Mojave, script (or SD) asks access to Contacts and Photos

mojave

#1

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?


#2

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.


(Mark Alldritt) #3

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.


#4

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.


(Mark Alldritt) #5

At the end of this blog post there are instructions for resetting permissions so the system will prompt you again:


#6

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…