Note: I accidentally originally posted this in the AppleScript OS X forum; I am reposting in the appropriate forum here:
About three years ago, I wrote an app using AppleScript and XCode 3.2 that helps our company’s designers “claim” images in Extensis Portfolio. A designer selects images from a Portfolio catalog, then enters information in three fields contained in an Interface Builder window. The app then enters that information in the appropriate fields in each selected Portfolio record, which streamlines data entry and ensures that all information is entered in the appropriate format.
Now I’ve been asked to make the app retain the information a designer enters. If a designer is claiming several different images for the same publication, they don’t want to re-enter all of the claiming information each time. The designer needs the freedom to select additional images in Portfolio and then rerun the claiming script, but of course relaunching the script currently forces them to re-enter all of the claiming information.
I thought properties would be the key, but eventually learned that they don’t fill this role in AS Studio. I’ve looked at bindings, but haven’t got a handle on how to successfully implement that technique in this scenario. I really enjoy working in AppleScript but I’m still a newbie to much of this. I’m hoping that someone here can offer some suggestions or code examples that can help me make sense of the best way to accomplish retaining information from one app launch to the next, perhaps auto-entering that info into the Interface Builder window from launch to launch. Thanks!
user defaults is the standard way to save/restore values and UI states.
First you have to register the keys (of type string, number, date, data, list and record) you want to save.
Then you need two handlers to read and write the preferences, normally in applicationWillFinshLaunching() and
There are a few articles regarding this issue in the unScripted and AppleScript Studio section
Right, but it depends on the preference strategy.
If you need a value also as property for key-value coding relationships
it might be more comfortable to read/write the value “manually” and bind the UI element to the property
StefanK and mouramartins, thanks so much to both of you for your responses. Because of the information shared in these forums, I was able to tweak my AS Studio project so that it now retains key information from one launch to the next. The designers who use the app are very pleased!