Sudo in applescript?

Discussion in 'Mac Programming' started by SirPorl, Sep 4, 2011.

  1. SirPorl macrumors newbie

    Sep 4, 2011
    I am pretty new to scripting and I am looking to create a script that will change some file flags on a folder that has been selected in finder. If possible I would like to do this from an admin account and be able to lock/unlock a folder on a non admin profile. Here is what I have come up with but I can't seem to figure out how to get it to run with sudo

    I need these two items to run as sudo, any assistance would be appreciated.

    if itemList is not {} then
    if theChoice is "Lock" then
    do shell script " chflags uappnd " & (itemList as text) --
    else -- unlock
    do shell script " chflags nouappnd " & (itemList as text) --
    end if
    end if
  2. chown33 macrumors 604

    Aug 9, 2009
    Sailing beyond the sunset

Share This Page