This was brought up in another post, but I wanted to have it here so it was easier to find.
A common question in scripting is how to save settings between sessions. Adobe Bridge supports saving script settings directly to Preferences, which also holds program settings. Photoshop does not support this method; script settings must be saved to a file on disk.
The script below is available on my Dropbox, you check there for any updates. Adobe Scripts
This script displays a small test window with various common controls and shows how to capture and save changes to those controls to an XML text file. I use a 'dialog' window for Photoshop compatibility but this also works with a 'palette' or 'window' in other apps that support Extendscript/Script UI.