Automated selection of metal-poor stars in the galaxy