RomanSmolka / finder-new-file

AppleScript applet to create an empty file in the current Finder window.
139 stars 13 forks source link

Always prompting for Accessibility Permissions #7

Open sirnacnud opened 7 months ago

sirnacnud commented 7 months ago

I am using release 1.0.2 on macOS 13.6.3. I had to remove the quarantine extended attribute to be able to run the app.

I have it added to Finder and have allowed permissions for Accessibility, as well as Automation permissions for Finder, System Events, and System Settings. Every time I run the app (either manually or via Finder), I get the below alert saying to enable Accessibility Permissions. A new file does get created, but the alert is really disruptive.

The alert looks strange with the ? mark symbols, is this a macOS bug?

Screenshot 2024-04-12 at 1 03 19 PM
hkphh commented 4 months ago

I solved this by adding .app file in privacy settings image

sirnacnud commented 4 months ago

I managed to get it fixed, but I had to give Script Editor Accessibility permission. I was able to do this by running the New File.applescript from the repo in Script Editor. Then after I allowed it, using the New File.app worked correctly. I guess the Script Editor is getting invoked somehow.

nifets commented 1 month ago

Hey, I fixed this by changing the error handling in the script to this:

on error theError number errorNumber
    tell me to activate
    if errorNumber is not 1002 then
        display dialog "Error: " & (errorNumber as text) & return & return & theError ¬
            buttons {"OK"} ¬
            default button 1 ¬
            with icon stop ¬
            with title "New File Applet"
    end if
end try

Before it was displaying the permissions prompt whenever the error is 1002 but seems the error gets thrown even after you change the accesibility settings.