I used this in the Twitter script, but I can save data into plists and I have made a make and delete script. Here is the write and read script:
set username to ""
set userpass to ""
set prefs to "com.logins.login"
try
set loginuser to (do shell script "defaults read " & prefs & " User")
on error F
if F contains " does not exist" then
set username to text returned of (display dialog "Since there is no stored username/password, please put in your username below." default answer "" buttons {"Cancel", "OK"} cancel button {"Cancel"} default button {"OK"} with title "User Name") & (beep)
do shell script "defaults write " & prefs & " User " & username
end if
end try
try
set loginpass to do shell script "defaults read " & prefs & " Pass"
on error F
if F contains " does not exist" then
set userpass to text returned of (display dialog "Since there is no stored username/password, please put in your password below." default answer "" buttons {"OK"} default button 1 with title "Password" with hidden answer) & (beep)
do shell script "defaults write " & prefs & " Pass " & userpass
end if
end try
if username is "" then
set username to loginuser
end if
if userpass is "" then
set userpass to loginpass
end if
set User to username as string
set Pass to userpass as string
Here is the script to reset the settings:
set prefs to "com.logins.login"
set PreferencePath to (path to preferences folder from user domain as Unicode text) & prefs as string
do shell script "rm -rf " & quoted form of the POSIX path of PreferencePath with administrator privileges
display dialog "The preferences have been reset." buttons {"OK"} with title "Reset!" & (beep)
To use the scripts, you CAN change the “com.logins.login” to ANYTHING (that includes numbers, letters, and unusual characters including Æ’, ©, and Ë™.)