• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Ownership and permissions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ownership and permissions


  • Subject: Re: Ownership and permissions
  • From: Mr Tea <email@hidden>
  • Date: Mon, 15 Dec 2003 15:29:27 +0000

On 15 Dec 2003, at 9.22 am, Peter Mathiessen wrote:

Anyone who knows if it is possible to change Ownership and permissions for a
file by applescript.

If so, please tell me how to do it.


Kinda... At any rate, the Finder's dictionary says that this is possible. Look under the 'item' entry for a full list of ownership and permissions commands.

--===========================================================
choose file with prompt "Choose something:" returning f

tell application "Finder"
set owner of f to "mrtea"
set owner privileges of f to none
set group of f to "staff"
set group privileges of f to none
set {o, op, g, gp} to {owner of f, owner privileges of f, group of f, group privileges of f}
end tell

{o, op, g, gp}
--===========================================================

(Any lines that abut the left margin of the message window have been wrapped and should be re-connected to the end of the previous line.)


The result returned suggested that the ownership and permissions had been changed as requested. However, looking in the same item's Finder info window showed different. The permissions had been changed, but owner and group had not. After running the above script, checking the file's owner and group with a script returned the changed values _until_ I opened the info window. Checking them with a script again after that showed that they had reverted to the original, unchanged values as displayed in the info window.

There's a whiff of Heisenberg here, in that the effect of the script cannot be directly observed without altering it. Using the Finder's update command made no difference; even logging out and back in again didn't make the changes stick. That seems like a pretty serious gotcha, although I'm sure that scripters who have to do this kind of thing with any regularity (I don't) will know of a way round it - maybe even with a yummy shell script.


Regards,


Nick
pp Mr Tea
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Ownership and permissions (From: Peter Mathiessen <email@hidden>)

  • Prev by Date: Re: Quark conflicting properties
  • Next by Date: Re: *****SPAM***** Re: Errors on Apple Applescript website
  • Previous by thread: Ownership and permissions
  • Next by thread: RE: Ownership and permissions
  • Index(es):
    • Date
    • Thread