Error "Not authorized to send Apple events to Messages"

dsds
Posts: 8
Joined: Sun Mar 01, 2015 10:41 pm

Error "Not authorized to send Apple events to Messages"

Post by dsds »

Hi,

I just installed and setup this plugin on Catalina, but am encountering the following error when trying to send a message:
messages error
messages error
Screen Shot 2020-02-17 at 2.40.38 AM.png (20.34 KiB) Viewed 8041 times
I've already enabled Full Disk Access permission, so I'm not sure what could be responsible.
Full Disk Access
Full Disk Access
Screen Shot 2020-02-17 at 2.40.07 AM.png (77.84 KiB) Viewed 8041 times
Any advice would be appreciated.

Thanks!
User avatar
jay (support)
Site Admin
Posts: 19232
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by jay (support) »

None of those are necessary. You might have to add the iMessages plugin though (I don't use it myself so I don't know if that'll work). I don't expect adding full disk access will make it work however since the error implies that it can't send AppleEvents (not access the disk).

Apple has now officially gone off the deep end (what Windows did years ago) when it comes to "security". I suppose their theory is that if the user can't do anything useful then the system is inherently "secure". Might as well just turn off the network, disconnect the keyboard and monitor... :( :? :cry:
Jay (Indigo Support)
Twitter | Facebook | LinkedIn
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by matt (support) »

Are you using Indigo 7.4.1?
Image
User avatar
GlennNZ
Posts: 1873
Joined: Sun Dec 07, 2014 3:33 pm
Location: Central Coast, Australia

Re: Error "Not authorized to send Apple events to Messages"

Post by GlennNZ »

Hi all,

https://applehelpwriter.com/2018/09/24/ ... le-events/

The above seems relevant to me, which suggests allowing full disk access to the correct apps (double check version as per Matt's post) would be the way to resolve.


Glenn
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by matt (support) »

Yes, definitely try the Terminal command (mentioned in that article) to reset the permissions then try having the plugin command the Messages app (to send a message I guess).

Code: Select all

tccutil reset AppleEvents; tccutil reset SystemPolicyAllFiles
Image
dsds
Posts: 8
Joined: Sun Mar 01, 2015 10:41 pm

Re: Error "Not authorized to send Apple events to Messages"

Post by dsds »

Thanks for the replies.

I'm running Indigo 7.4.1 and Catalina 10.15.3. I reset my permissions with the terminal command, but it didn't make any difference.

I think the first time it's run it should prompt me to allow access to Messages, but I never see the system dialog window pop up.

Are you guys currently running Catalina yourselves?

Thx.
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by matt (support) »

I tested Catalina with a plugin that use the applescript module to commands Music/iTunes. It worked. It was a while ago, but I believe I got the macOS prompt to allow it the first time it tried to send the message to Music. I didn't try it with Messages.
Image
Andreas
Posts: 19
Joined: Fri Nov 24, 2017 11:51 pm

Re: Error "Not authorized to send Apple events to Messages"

Post by Andreas »

Hi, I am facing the same issue.:

iMessage Plugin Debug A error of type :ScriptError occured. The longer message is :Not authorized to send Apple events to Messages.
iMessage Plugin Error An Error occured within the iMsg AppleScript component - ScriptError
iMessage Plugin Error The Error was :Not authorized to send Apple events to Messages. (-1743) app=u'Messages' range=99-101
iMessage Plugin Debug A error of type :ScriptError occured. The longer message is :Not authorized to send Apple events to Messages.
iMessage Plugin Error An Error occured within the iMsg AppleScript component - ScriptError
iMessage Plugin Error The Error was :Not authorized to send Apple events to Messages. (-1743) app=u'Messages' range=99-101

I just migrated to Indigo 7.4.1 and changed to a new Mac with Catalina. It worked without problems before (7.3.1 on El Capitan).

Running the tccutil command and reboot did not help.

The OS X account that runs Indigo does not have admin privileges.

Andreas
Andreas
Posts: 19
Joined: Fri Nov 24, 2017 11:51 pm

Re: Error "Not authorized to send Apple events to Messages"

Post by Andreas »

... and granting admin privileges to the OS X account does not help either...

Andreas
Woetjes
Posts: 117
Joined: Mon Apr 04, 2016 6:44 am
Location: Belgium

Re: Error "Not authorized to send Apple events to Messages"

Post by Woetjes »

Same issue here :cry:

I'm trying to control the Spotify/Music app with an AppleScript through Python from Indigo 7.4.1 on Catalina (the script was working on El Capitan).
If I run a standalone Python script from terminal, I get the security popup message where I need to allow communication between terminal & Spotify.
Running the same script from the Indigo server, I get the 'ScriptError: Not authorized to send Apple events to Spotify.' error message and the popup doesn't appear.

Very very very very annoying issue :(
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by matt (support) »

We will have this macOS bug worked around in the next Indigo release (7.4.2).
Image
User avatar
Korey
Posts: 888
Joined: Wed Jun 04, 2008 11:47 am
Location: Henderson, NV
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by Korey »

Frack.

I tried the reset all command to get iMessage to work and now my Spotify script no longer functions :cry:

Code: Select all

 Script Error                    Spotify Status.py: Not authorized to send Apple events to Spotify. (-1743) app=u'Spotify' range=55-67
   Script Error                    Exception Traceback (most recent call shown last):

I added plugin host and indigo server into the full access permissions but still no luck.

Anyone know what files I need to pull from my backup to fix the wipe?

Code: Select all

tccutil reset AppleEvents; tccutil reset SystemPolicyAllFiles


This is the script BTW (set to run every 10 seconds)

Code: Select all

import applescript

spotifyScript = '''
tell application "Spotify"
  set strState to (get player state) as string
  set strTrack to (get name of current track) as string
  set strArtist to (get artist of current track) as string
  set strAlbum to (get album of current track) as string
end tell
set blnPlaying to (strState is equal to "playing" or strState is equal to "paused")
set returnRec to {SpotifyPlayerState:strState}
set returnRec to returnRec & {SpotifyIsPlaying:blnPlaying as string}
if (blnPlaying) then
   set returnRec to returnRec & {CurrentArtist:strArtist}
   set returnRec to returnRec & {CurrentAlbum:strAlbum}
   set returnRec to returnRec & {CurrentTrack:strTrack}
end if

return returnRec
'''

a_script = applescript.AppleScript(source=spotifyScript)
reply = a_script.run()

for var_name, value in reply.items():
    indigo.variable.updateValue(str(var_name), value=value)
OSX 10.14.6
Indigo 7.4.1
--
Korey
User avatar
matt (support)
Site Admin
Posts: 21542
Joined: Mon Jan 27, 2003 1:17 pm
Location: Texas
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by matt (support) »

I believe we have a solution to workaround this bug in the next version of Indigo.

In the mean time you can try this other workaround I found. Open the Script Editor application and create a new script file that has one of the following snips (depending on the app you're trying to control):

Code: Select all

tell application "Messages"
	name of every buddy
end tell

Code: Select all

tell application "Spotify"
	sound volume
end tell

Code: Select all

tell application "iTunes"
	sound volume
end tell

Code: Select all

tell application "Music"
	sound volume
end tell
Then save that as an .scpt file. Next create an Action Group in Indigo that executes that script file. Execute the Action Group and with any luck macOS will prompt you to allow it. Once you accept that then your other python script file should start to execute without being blocked (and you can delete the Action Group and .scp file).
Image
User avatar
Korey
Posts: 888
Joined: Wed Jun 04, 2008 11:47 am
Location: Henderson, NV
Contact:

Re: Error "Not authorized to send Apple events to Messages"

Post by Korey »

matt (support) wrote:I believe we have a solution to workaround this bug in the next version of Indigo..
Thanks Matt, I ended up restoring from my nightly backup with SuperDuper! using the "Copy Different Files" option.

I'm back in action. :D

That Spotify script is critical for WAF in my installation :) :)
--
Korey
MarcoGT
Posts: 1148
Joined: Thu Sep 11, 2014 1:06 pm
Location: Germany

Re: Error "Not authorized to send Apple events to Messages"

Post by MarcoGT »

Full Disk Access to Messages does not help...any other idea?
Post Reply

Return to “iMessage”