Re: Write a prefs file
Re: Write a prefs file
- Subject: Re: Write a prefs file
- From: Philip Aker <email@hidden>
- Date: Tue, 28 May 2002 00:22:06 -0700
On Monday, May 27, 2002, at 04:45 PM, webguide wrote:
G'day all,
I'd like display a dialog and the write the result a prefs
file. I've done
this many times before but have always used plain text files.
I'd like to write a 'true' prefs file rather than a plain text
file - can
this be done using the write commands of vanilla AS?
kim
I don't believe there's any hard stipulation that one's
preference file has to be binary or have data in the resource
fork on any Mac platform. By convention, preference files are
kept in the preferences folder because you can't be sure that
your application will be running on locked media or not. The OS
9 file type is 'pref' and the creator should be either '????' or
a unique creator ID that you have registered with Apple. Since
it just went by a few posts ago, if you did want to keep some
values in a resource fork, you could easily store a script in
your prefs file and locate it in the Preferences folder. The
'path to' command will give you the correct location for the
platform your app (or script) is currently running on. On OS X,
and for some applications on OS 9, it's becoming common to use
XML format files to store preferences in. These are text files
which are usually in AppleScript's "Unicode" text. You name them
by Java convention--the name of your prefs file might be
something like: "au.com.optushome.NAME_OF_YOUR_APP". You can
examine these files with any text editor or the Property List
Editor application, to see how they are arranged. I think
AppleScript studio will read and write these files with some
call to NSUserDefaults mapped to a scripting command.
Philip
mailto:philip@vcn.b
c.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.