@lainz: I didn't realise that with Win10... that pretty much means that checking for the association is less necessary. The overhead of setting it every time is probably the same as checking it every time, so I'll just leave it in there to run every time.
@jamie: Thanks for that. I'll take a look, but in this instance I think getting it working is probably more trouble than it's worth given what lainz said.
Thanks,
Dan