• 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: Storing preferences?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • RE:Storing preferences, part deux
      • From: James Burns <email@hidden>
    • RE:Storing preferences, part deux
      • From: James Burns <email@hidden>
    • Storing preferences, part deux
      • From: James Burns <email@hidden>
References: 
 >Storing preferences? (From: James Burns <email@hidden>)

  • Prev by Date: Re: Scriptable notepad? (ditching Entourage)
  • Next by Date: Encrypting passwords with AS
  • Previous by thread: Storing preferences?
  • Next by thread: Storing preferences, part deux
  • Index(es):
    • Date
    • Thread