Page 1 of 1

Need some quick help - need a macro for extracting a list

Posted: 2010-11-29 15:43:34
by loulesko
Hey all,

I've got a book due at the publisher and I've used list style to indicate the illustrations like this:

[ 5 Fig 1 ] Caption of image

Could one of you macro geniuses help me out with a macro to extract the each Fig and place on a separate document. Like I mentioned I'm using a list style at Level 1 if that's any help. Each Fig id on its own line as well.

Many, many thanks
Lou

Re: Need some quick help - need a macro for extracting a li

Posted: 2010-11-29 15:59:25
by martin
Hi Lou. This won't be too much of a problem, but let's clarify what you've got in your document exactly. As an example, does your document look something like this:
Picture 2.png
Picture 2.png (12.66 KiB) Viewed 4124 times
I turned on show invisibles so you can see the newlines. Also the automatically generated list item/number is highlighted in light green.

Does that look like what you've got? If not, perhaps you can take a screenshot of one of your images and its caption. Thanks.

Re: Need some quick help - need a macro for extracting a li

Posted: 2010-11-29 17:41:05
by loulesko
Martin,

That's it exactly. Except there is no image. Just the text. But your format assumption is dead on.

The images are being added by the publisher once we corral them together, which is what we need the Fig list for.

Thank you so much.

Lou

Re: Need some quick help - need a macro for extracting a li

Posted: 2010-11-29 17:57:21
by martin
Ah, okay, all is understood, thanks. Give the following macro a try:

Code: Select all

Find All '\[\d+ Fig \d+\]\t.*\n', 'E'
Copy Text Only
New
Draft View
Paste
When you run it on the frontmost document it should make a new document listing all image numbers and captions. Let me know if it gives you any troubles or wasn't what you were after.

Re: Need some quick help - need a macro for extracting a li

Posted: 2010-11-29 22:09:21
by loulesko
It worked fabulously. Exactly what I needed to get me back on schedule.

As a thank you I made a donation in Nisus' honor to "Reading is Fundamental", a charity that helps challenged children with literacy. Basically it's investing in the next generation of writers.

http://www.rif.org/us/about-rif.htm

Thank you so much for your help.

Lou

Re: Need some quick help - need a macro for extracting a li

Posted: 2010-11-30 09:55:22
by martin
Happy to help- I'm glad the macro works for you. Thank you for the donation Lou- that's very gracious! :)