RecycledGeek

Q: ScriptEditor cannot access Contacts

I am attempting to write an AppleScript to be able to check my calendar, and tell me if someone in my contacts has a birthday / anniversary / date in the next 5 day so I can then remind myself to snail mail a physical card.

 

When I try to run my script, it says it doesn't have permission to access the date of any of my contacts.

Screen Shot 2016-07-09 at 7.18.58 PM.png

But when I try to allow Script Editor to access my Contacts, there's no option to do so in the System Preferences --> Security & Privacy Pane

Screen Shot 2016-07-09 at 7.24.56 PM.png

Due to this security block I am not able to run my script and test if it works.

 

Is there any way to add ScriptEditor as a valid app to access my Contacts?

 

NOTE: I am on Yosemite and the help page for Mavericks (here) was not helpful.

MacBook Pro (13-inch Late 2011), OS X Yosemite (10.10.4)

Posted on Jul 9, 2016 5:32 PM

Close

Q: ScriptEditor cannot access Contacts

  • All replies
  • Helpful answers

  • by red_menace,

    red_menace red_menace Jul 9, 2016 7:18 PM in response to RecycledGeek
    Level 6 (15,526 points)
    Desktops
    Jul 9, 2016 7:18 PM in response to RecycledGeek

    Add the Script Editor to the Accessibility pane.

  • by RecycledGeek,

    RecycledGeek RecycledGeek Jul 9, 2016 7:35 PM in response to red_menace
    Level 1 (4 points)
    Mac OS X
    Jul 9, 2016 7:35 PM in response to red_menace

    It already is. And as I noted earlier, the help page for Mavericks (here) was not helpful.

    Screen Shot 2016-07-09 at 9.34.10 PM.png

  • by red_menace,

    red_menace red_menace Jul 9, 2016 7:48 PM in response to RecycledGeek
    Level 6 (15,526 points)
    Desktops
    Jul 9, 2016 7:48 PM in response to RecycledGeek

    The Script Editor won't show up under the Contacts pane as in your first post.  You might try using the bundle identifier (e.g. tell application id "com.apple.addressbook"), since I've noticed some terms don't seem to be accepted when using the application name.

     

    Also, are you saving the script as an application?  If you are running it as an application, that also needs to be added to the Accessibility pane.

  • by RecycledGeek,Solvedanswer

    RecycledGeek RecycledGeek Jul 9, 2016 8:20 PM in response to red_menace
    Level 1 (4 points)
    Mac OS X
    Jul 9, 2016 8:20 PM in response to red_menace

    By simply restarting my machine and "rephrasing" how the code was written the error went away on its own...
    Maybe that is why it was labeled as a "Syntax Error"? Really weird...

     

    I eventually plan on saving the script as a script and using cron to run it for me. Are there any precautions I can take so that when this runs outside of the accepted "Script Editor" things don't give me more security issues?

  • by red_menace,

    red_menace red_menace Jul 9, 2016 8:46 PM in response to RecycledGeek
    Level 6 (15,526 points)
    Desktops
    Jul 9, 2016 8:46 PM in response to RecycledGeek

    Running it as a regular script shouldn't be a problem (not sure about using osascript).  If running it as an application you will need to codesign it or make it read-only, since scripts modify themselves (to save properties and globals) so the application will be seen as a different one.