I will have a search, I think I put a copy of it here on the forum once before.
Edit, found it. The mount initialisation stuff has changed as I have a different mount now, but the rest works more or less the same. It is a two sequence script, but if you only have one target for the night you can just change the script to make it jump from sequence one to the flats or end of night section instead of the second sequence.