While I'm not volunteering to write the script, I would encourage you to tackle it yourself. It is hardly a pie-in-the-sky project, and if you have any desire to expand your abilities, this would be a worthwhile exercise.
You've already taken the first step by outlining the basic structure.
There are several threads you might find useful in putting it all together
http://forums.adobe.com/thread/959627?tstart=0 --The main subject is about deleting aframes, but it spends a bit of time discussing how to iterate through all the frames in a document and determining their contents.
http://extendingframemaker.blogspot.com/2012/01/getting-elements-text.html --While the listed subject is getting text from an element, the approach is very similar to how you get text from a paragraph
http://forums.adobe.com/thread/926370?tstart=0 --Regarding setting attribute values