Blank Automation Box: Cannot Get Permission for Word 16.52 on Big Sur 11.5.2
Been trying to get permission for word to use Zotero on Mac, but the automation box is empty. I tried wiping all the previous settings of Zotero via the terminal as suggested in a thread, but to no avail. Help?
I haven't tried rebooting yet, and I don't have a report ID.
I just recently upgraded from 10.13, and got this error the first time I tried using Zotero since then. Restarting didn't change anything for me.
Also, entering the following in Terminal:
osascript -e 'tell application "Microsoft Word" to insert text "hello" at the end of text object of active document'
does trigger a permission dialog for Word, so this seems to be some sort of issue between Zotero and Word.
tccutil reset AppleEvents
and then attempt to use Zotero with Word again? Are both Zotero and Word installed in the usual location under /Applications?Zotero and Word are both in /Applications.
First off, the database for these permissions can be manually edited using sqlite commands. To create an entry in the database, you essentially need to have the domain of the app (org.zotero.zotero and com.microsoft.Word) along with a string of binary code (BLOB) that represents essentially an identifier for the specific apps involved.
I relied extensively on this Stack Overflow post to get started in this, however I want to add that their method for creating the BLOB seems to be slightly invalid on 10.15.7 as they were different (slightly) from the ones generated by the native permissions panel. Maybe someone who knows what they are doing can figure out why. [ https://stackoverflow.com/questions/52706542/how-to-get-csreq-of-macos-application-on-command-line/57259004 ]
Since I couldn't use those, I had to copy the BLOB generated in entries created by the permissions window (it was easier for me to browse the sqlite database using a GUI app like DB Browser for SQLite). The oascript command previously mentioned generates the correct BLOB for MS Word. The one for Zotero was more difficult... however I found it could trigger an entry for System Events sometimes (perhaps related to leaving the beta Zotero Word plugin in place while trying to use the release version of Zotero).
Anyways, in the end, after running
tccutil reset AppleEvents
to clear everything, entering the following commands in Terminal will properly setup Zotero access in Word for me. This is on 10.15.7 with MS Word 16.54 and Zotero 5.0.96.3, so results not necessarily guaranteed on other systems. I have system integrity protection OFF (for other reasons)... I don't think that comes into play here, but just FYI.The first part sets up some variables for the sqlite entry, the last line actually enters the the change to the sqlite database.
DATABASE_USER="/Users/"$USER"/Library/Application Support/com.apple.TCC/TCC.db"
SOURCE_APP_ID=org.zotero.zotero
SOURCE_APP_CSREQ="X'fade0c00000000a0000000010000000600000002000000116f72672e7a6f7465726f2e7a6f7465726f000000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a384c41595233363759560000'"
PERMISSION_GRANTED=1
AUTOMATED_APP_ID=com.microsoft.Word
AUTOMATED_APP_CSREQ="X'fade0c00000000a000000001000000060000000200000012636f6d2e6d6963726f736f66742e576f72640000000000060000000f000000060000000e000000010000000a2a864886f76364060206000000000000000000060000000e000000000000000a2a864886f7636406010d0000000000000000000b000000000000000a7375626a6563742e4f550000000000010000000a554246385433343647390000'"
sqlite3 "$DATABASE_USER" "REPLACE INTO access VALUES('kTCCServiceAppleEvents','"$SOURCE_APP_ID"',0,$PERMISSION_GRANTED,1,$SOURCE_APP_CSREQ,NULL,0,'"$AUTOMATED_APP_ID"',$AUTOMATED_APP_CSREQ,NULL,?);"
When I run this command (@tacameron) in Terminal, the command fails because the table contains 13 columns and only 12 columns are inputted.
The last line I edited became:
sqlite3 "$DATABASE_USER" "REPLACE INTO access VALUES('kTCCServiceAppleEvents','"$SOURCE_APP_ID"',0,$PERMISSION_GRANTED,1,1,$SOURCE_APP_CSREQ,NULL,0,'"$AUTOMATED_APP_ID"',$AUTOMATED_APP_CSREQ,NULL, NULL);"
And problem solved.