Re: write file to /Library/Preferences
Re: write file to /Library/Preferences
- Subject: Re: write file to /Library/Preferences
- From: David LeBer <email@hidden>
- Date: Thu, 21 Feb 2008 18:26:43 -0500
On 21-Feb-08, at 6:20 PM, Luther Fuller wrote:
On Feb 21, 2008, at 3:47 PM, Philip Aker wrote:
On 2008-02-21, at 12:48:21, Rainer Standke wrote:
is it possible from AppleScript to write a file to /Library/
Preferences if the current user is not an administrator? How?
If you have an administrator password, almost anything is possible.
Otherwise, no.
I have a managed (non-admin) account named "dummy" for testing these
things.
So I ran this in "dummy" to see what happened ...
do shell script "defaults write com.authorName.applName x y"
No password was required. A new preference file named
"com.authorName.applName.plist" appeared in the /dummy/Library/
Preferences/ folder.
Note1: This .plist preference file contains just the key "x" which
is always a string having the value "y". (As indicated by my
experiments. The 'defaults' man page says there should be some
quotes in there.) You'll have to create a preference file where "x"
and "y" are replaced by something meaningful to your project.
Note2: Read and write a plist preference file using System Events.
It knows how to translate xml to/from AppleScript records. No
special formatting required.
Users always have write access to their own ~/Library folder. I
believe it is the machine level /Library folder the op was asking about.
;david
--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site: http://codeferous.com
blog: http://davidleber.net
profile: http://www.linkedin.com/in/davidleber
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden