Re: Storing preferences?
Re: Storing preferences?
- Subject: Re: Storing preferences?
- From: Philip Aker <email@hidden>
- Date: Wed, 05 Feb 2003 16:03:08 -0800
On Wednesday, February 5, 2003, at 12:31 PM, James Burns wrote:
Here's what I'm trying to do -- Write a preference file.
My questions?
1/ What's the best way to implement this? I looked at the sample
application in the examples/applescript studio folder of the December
2002 developer's release, but can't quite wrap my head around what's
involved. Is there a simple scheme for doing this just with
Applescript i/o commands, and not calling obscure Cocoa routines?
2/ In that vein, is there a way to overwrite files automatically
(without user intervention) if they exist? That way I could write a
simple text file with the info I want to retain between sessions
without bugging the user at quitting time.
3/ Any suggestions for the structure of the preference file? Text?
Records? Delineated how?
The shell command 'defaults' can do amazing things if your requirements
for a preferences file are modest.
In Terminal or in a 'do shell script' this will create your prefs file
if it doesn't exist and put in the first entry:
defaults write com.burns.FirstApp SomePref "99"
This will retrieve it:
defaults read com.burns.FirstApp SomePref
This technique is even good for itty-bitty AppleScripts.
Cheers,
Philip Aker
http://www.aker.ca
_______________________________________________
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.