|
|
Code samples for an AppleScript preferences system
I think you're making it overly difficult...
You can write a preference to a file in Terminal with
You can read a named preference with
Then you can execute these commands in AppleScript with
Code samples for an AppleScript preferences system
The
defaults command requires the BSD subsystem to be installed or it will fail - for AppleScript Studio applciations you should use the AppleScript Version of theis command (which is part of the AppleScript.framework and thus always present):
default entry [of ...]
If you use of user defaults, there is no need to add a prefs name, it will automatically use the application's bundle identifier.
Here are some handlers I use for reading/writing prefs (the reading one allows you to set a default value in case the key is not present - if no value is present in the prefs file, a new key with the default value will be added. That way you are sure to always get something back...):
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|