Assistive Access

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Assistive Access Wed Jun 08, 2016 4:42 pm • by Karl.Browning
From the log file: "hazelworker is not allowed assistive access"

This occurs because I am attempting to "do menu" commands in AppleScript which require app-by-app authorization to access to the Assistive Access.

How can I tell OS X that Hazelworker is an ok gal to have access? I cannot find such an app as Hazelworker. Or Hazel.

Background: I've tried several methods to parse a pdf to create a name from text in the document. The best so far is to use PDFpen. BUT, to get access to the text date programmatically one must copy the text to the clipboard. PDFpen does not support any other file action for access. Thus, my need for the AppleScript called by Hazel to have UI access. I run this standalone and it works like a champ (ScriptDebugger has been authorized for UI access).

Thanks for any help you can offer.
Karl
Karl.Browning
 
Posts: 16
Joined: Sun Dec 09, 2012 10:18 am

Re: Assistive Access Thu Jun 09, 2016 11:51 am • by Mr_Noodle
Check the security preferences in System Preferences. Though, it might be better to make sure your script tells System Events to do any UI stuff, which may get around setting up permissions.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Assistive Access Thu Jun 09, 2016 1:42 pm • by Karl.Browning
Mr_Noodle wrote:Check the security preferences in System Preferences. Though, it might be better to make sure your script tells System Events to do any UI stuff, which may get around setting up permissions.


I may be misunderstanding what you are telling me. As I understand it: an app must be granted Accessibility authority via System Preferences>Security & Privacy>Accessibility.

To do so one must: specify the application - via finder.

This works when I run the script using Script Editor or Script Debugger apps.

When running the script as a Hazel action (I've tried both embedded and standalone) the error mentioned occurs.

I cannot find anything in the System Events dictionary or googling that permit overriding or bypassing those settings.

As always. I appreciate whatever help you can offer.
Karl
Karl.Browning
 
Posts: 16
Joined: Sun Dec 09, 2012 10:18 am

Re: Assistive Access Fri Jun 10, 2016 8:34 am • by Karl.Browning
Karl.Browning wrote:
Mr_Noodle wrote:Check the security preferences in System Preferences. Though, it might be better to make sure your script tells System Events to do any UI stuff, which may get around setting up permissions.


I may be misunderstanding what you are telling me. As I understand it: an app must be granted Accessibility authority via System Preferences>Security & Privacy>Accessibility. ...


Mr Noodle -
I installed a Hazel release that came in yesterday, 6.9.16 - V4.0.2. As soon as that update installed, the Hazel Action that invoked my script that uses UI menu interface ran - and ran like a champ. When I then looked at Syst. Preferences>Security>Accessibility - Hazel is now an option. Thanks so much for your consideration and attention.
Best to you
Karl
Karl.Browning
 
Posts: 16
Joined: Sun Dec 09, 2012 10:18 am

Re: Assistive Access Fri Jun 10, 2016 12:26 pm • by Mr_Noodle
I didn't really do anything specifically to fix this but "you're welcome?"

The permissions stuff is a bit inconsistent so who knows what happened there.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Assistive Access Wed Mar 21, 2018 1:27 pm • by dmayo2
Bummer, I don't see Hazel as an option in SysPref>Security>Accessibility. Running Hazel 4.2.4 on macOS 10.12.6

I've created a script that runs fine in Script Editor, but fails when embedded or when running as an external script. I've read the help about using AppleScript needing a handler in an external script.

Seems that it fails when the script needs to interact with the UI.
Code: Select all
hazelworker[30268] [Error] AppleScript failed: Error executing AppleScript on file /Users/name/Scans/2017-08-25-18-04-36.pdf.
2018-03-21 13:20:55.566 hazelworker[30268] OSAScript error: {
    NSLocalizedDescription = "System Events got an error: hazelworker is not allowed assistive access.";
    NSLocalizedFailureReason = "hazelworker is not allowed assistive access.";

Code: Select all
tell application "Adobe Acrobat Pro"
   activate
   open theFile
end tell
tell application "System Events"
   tell process "Acrobat"
      click the menu item "Convert-2b-file" of menu 1 of menu item "Action Wizard" of the menu "File" of menu bar 1
   end tell
end tell


I'm using Adobe Acrobat X to take an OCR'd PDF scanned from a ScanSnap that dumps into a folder. I want to automate Acrobat's conversion to PDF/B-2b archival format. Works fine when I run the AppleScript and have hardcoded file (as opposed to `theFile`).

The embedded script will open Acrobat, load the file, but then it fails when System Events tries to click menu items in Acrobat.

Any ideas?
Thanks.
dmayo2
 
Posts: 8
Joined: Wed Mar 21, 2018 1:14 pm

Re: Assistive Access Thu Mar 22, 2018 11:04 am • by Mr_Noodle
I don't think you need to use System Events here since you are already telling Acrobat to do things. Also, is there a reason you have them in separate "tells"?
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Assistive Access Tue Jun 26, 2018 10:50 pm • by dmayo2
Thanks for the help here. I have the script and Hazel running nicely with my intended use. Wrote a post about it which also has all the code snippets and rules laid out (I don't mean for this to be click bait, but wanted to close out this post with my solution): https://simpleprogrammer.com/awesome-au ... ss-office/
dmayo2
 
Posts: 8
Joined: Wed Mar 21, 2018 1:14 pm


Return to Support