Can I populate a pop up button with a list contained in a text file?


I am working on an AppleScript Studio project that will help our users “claim” images in Portfolio 8. In the window I’m creating in Interface Builder, the user will pick a client from a pop up button list, then enter a job number and, finally, a date. When they click OK, that information will be added to fields in every record that the user has selected in Portfolio.

I would really like the pop up button to display a list of clients that will come from a text file that will live on one of our servers. That way, any authorized user can update the list of clients (rather than me having to update the list somewhere in code every time a client is added or dropped). Then, every time the “claiming” app is run, the pop up button will display the most recent list of clients.

I’ve worked with AppleScript a bit, but am pretty much of an Xcode newbie. Any help will be greatly appreciated. Thanks!

Kevin Stauffer


in this thread is described how to populate a popup button from a list. Instead of the Finder tell block you can read a text file. Assuming the text file contains the items in paragraphs, you can write

set a to paragraphs of (read file "theVolume:path:to:file.txt")

Thanks Stefan! I haven’t got the Xcode part right yet but I know that the “read file” is working based on a test I ran in Script Editor. I have a feeling that the Xcode failure is attributable to my skills (or lack thereof) in AS Studio, so I’ll keep at it.

Thanks again,