Meera,
I thought this sounded like a great idea for a sample script. I thought I would write one and add it to my free samples collection on my website, but it turns out that I just cannot get it to work. I gave it several hours but no luck. I'm nearly certain there is some kind of bug here. There is another thread where others have had the same problem, with no resolution posted:
http://forums.adobe.com/message/6138877
If a resolution becomes available, I'll post a sample script that does this. Otherwise, I'm out of ideas.
Russ