Jump to content

meadeiator

Member
  • Posts

    12
  • Joined

  • Last visited

Reputation Activity

  1. Thanks
    meadeiator reacted to deanishe in Using NSAppleScript/Run Script in Alfred Workflow 'with administrator privileges' produces errors   
    Don't use Run NSAppleScript. It does weird things. Use Run Script with Language = /usr/bin/osascript (AS) instead.
  2. Like
    meadeiator got a reaction from deanishe in Using NSAppleScript/Run Script in Alfred Workflow 'with administrator privileges' produces errors   
    deanishe, thank you for the suggestion.
     
    I attempted the following in a NSAppleScript:
     
    on alfred_script(q)
        do shell script "rm -r '/Users/path/to/folder/'" with administrator privileges
    end alfred_script
     
    and got the following error.
     
    NSAppleScriptErrorAppName = "Alfred 4";
        NSAppleScriptErrorBriefMessage = "rm: /Users/path/to/folder/: Operation not permitted";
        NSAppleScriptErrorMessage = "rm: /Users/path/to/folder/: Operation not permitted";
        NSAppleScriptErrorNumber = 1;
        NSAppleScriptErrorRange = "NSRange: {22, 160}";
    }
    ...which led me down the path of searching for "operation not permitted" and another post of yours about "macOS is basically a UNIX system with Cool Apple Shit layered on top." 🙂
     
    ...which, after confirming that Alfred has Full Disk Access (which it did), when I switched to using Run Script with /bin/bash allowed it to work without sudo.
     
    So, I think I found my solution with your previous solution...and a little bumping around in the dark on my end.  🙂
     
    Thank you again and have a great day.
×
×
  • Create New...