You could use the API per:
But, to be honest, by the time you finish writing the script you would probably finish with all your clicking.