Thanks for your help guys. I had got it right originally in the way Jonathan's first script shows, using convert. The thing that threw me and made me think it...
Amazing what an hour's thought can do. Have figured it out. Probably not the most efficient way of doing it but it works!! Code below if anyone's interested.