I assumed that the target file would be a carriage return delimited file with one list element per line. This matches well with the standard output of an SQL query and many other programs. I needed a function that took a file name argument and read it into a List. My first function to accomplish this is in Listing 1 . I quickly realized I didn't have a complete solution.
File names are fine but they are so specific .
To go back to the original example of a printer control program, there isn't a convenient file with the names of the printers listed for you, although the program lpstat -v gives you the names of the printers. I also found that even when a file was maintained, I needed to massage it, usually with awk , before it was suitable for a list. For database access I needed to run SQL and massage. So I wrote similar functions that took an argument of a program to run. This had the advantage of allowing customizing outside the GUI program.