“is not allowed for assistive access” error when running AppleScript from Java

后端 未结 4 1000
有刺的猬
有刺的猬 2020-12-15 18:11

I have a Jenkins config that executes Java tests for OS X app using Maven. And when I\'m trying to run some AppleScript that requires assistive access for it, different erro

4条回答
  •  醉梦人生
    2020-12-15 18:33

    I've resolved something like this problem before by inserting osascript into the TCC.db using tccutil.py

    After installing I linked tccutil.py into the path.

    sudo ln -s /source/tccutil/tccutil.py /usr/bin/tccutil.py 
    
    ls -l /usr/bin/tccutil.py 
    lrwxr-xr-x  1 root  wheel  26 30 Dec 14:57 /usr/bin/tccutil.py -> /source/tccutil/tccutil.py
    

    Then to allow osascript access to control your computer use the following compand

    sudo tccutil.py --insert /usr/bin/osascript
    

    I even added the script when the problem happened again later on.

    sudo tccutil.py --insert $(pwd)/transcribe-audio-to-text.js
    

    That failed so I rebooted which worked :-)

    transcribe-audio-to-text.js currently uses System Events to make TextEdit be able to save a text file. It's part of virtual assistant which is very alpha at 20160105 but the source is interesting. virtual-assistant

提交回复
热议问题