DH and I grew up in Wiltshire and still visit once a month or so.
I love Bradford On Avon (was born there) and would love to go back. Small town, lovely park and area to walk around, quite rural, easy to get into Bath, small town, not many shops but generally very pretty place. Nice walks along the river and canal, pretty wharf area.
We have relatives that live in Melksham and Trowbridge. Trowbridge has quite a decent town centre for local shopping, tescos, nice park in the centre.
Melksham has a sainsburys, reasonable town centre, not as big as Trowbridge, not many chain shops. Fairly reasonable park. Melksham always seems to me to be dominated by the Avon factory.
My choice would out of the above 3 would be Bradford On Avon without a doubt.
I've no idea on the schools, there is only one secondary school in Bradford and 2 infants I think.
Trowbride, several secondary schools and probably lots more infants.
And in Melksham I beleive there is only 1 secondary school and no idea about infants