problems with picking objects

in code, how can I do this?