I just happened to stumble upon this thread while looking for the same type of text export process. I just tried the script, and it works brilliantly.
The only enhancement I would make to the script would be to have it only recognize the current active layer. I had two brochure designs in one file, and it exported text for both into the file. That’s fine because it was exactly what I needed for this situation, but I could see only wanting text for a particular layer to show up.
Thanks again. Awesome script.