checking and locking plist's

Hi Guys,

Im after a script that checks if a plist is locked or not, and gives you the option to lock or unlock it…

ive looked around and found this script from glennmcdonald on checking certain keys in plists but when i tried to edit to to check if its locked it fails (unsure if locked is a key within a plist?!?)


tell application "system events" to return the value of property list item "locked" of property list file ((path of preferences folder) & "com.apple.dock.plist")

Thats all i have so far… but as that doesnt work and i cant get my head around how i would get it to work… im stuck, any ideas?

Cheers

What are you trying to accomplish that you need to worry about this?

I have a user account that is locked down, for example the com.apple.dock.plist is locked to stop icons being removed/added from the dock.

now locking and unlocking the plist is abit long winded going through finder, this is why i would like a script to do it for me.

Hi,

the information whether the file is locked isn’t stored in the plist file itself.
Try this

set isLocked to locked of (info for alias ((path to preferences as Unicode text) & "com.apple.dock.plist"))

Think about that for a moment, dgorjup31 ;). If the info was in a locked file, how could it ever be unlocked?

Good Grief :wink:

The information whether the file is locked is no property list item of the plist file

Does this please you more, Adam?

I keep thinking that a better solution might be to have a logout hook that resets the user to “standard” settings, rather than trying to prevent the user from messing with a plist file in his or her own user folder.