Assigning selection names to many objects


I’m wondering whether someone could help me out (again!).

I have a scene with many points in 3D space. Their positions are defined by input from a text file. I would like to be able to click on one of these points and use printf or the title bar to display a variable value from the input file. I understand defining selection names can be used to similar effect by hardcoding object names in the code, but I need a program that will work when I vary the number of points (or values of other variables) within the input file.

Any suggestions?

Many thanks,

Alternatively, I could just use the exact location of the object clicked on in x, y, z space. Would this be easier? If so, it seems fairly trivial to then conduct a strcmp test on the text file.