I don't know of any free software that will do that.
I'm using Ulead Gif animator, and it will do what you want, but I don't think it's the best animation software out there.
If I didn't have this software, I'd use IrfanView to automatically make the screen captures (Options - Extract all frames) then delete the frames I didn't want, and use a free program like
UnFREEz to make the gif.