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

Get help using and writing Nisus Writer Pro macros.
Post Reply
User avatar
loulesko
Posts: 89
Joined: 2008-01-20 11:08:35
Location: California
Contact:

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

Post by loulesko » 2010-11-29 15:43:34

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

User avatar
martin
Official Nisus Person
Posts: 4261
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

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

Post by martin » 2010-11-29 15:59:25

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 4116 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.

User avatar
loulesko
Posts: 89
Joined: 2008-01-20 11:08:35
Location: California
Contact:

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

Post by loulesko » 2010-11-29 17:41:05

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

User avatar
martin
Official Nisus Person
Posts: 4261
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

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

Post by martin » 2010-11-29 17:57:21

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.

User avatar
loulesko
Posts: 89
Joined: 2008-01-20 11:08:35
Location: California
Contact:

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

Post by loulesko » 2010-11-29 22:09:21

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

User avatar
martin
Official Nisus Person
Posts: 4261
Joined: 2002-07-11 17:14:10
Location: San Diego, CA
Contact:

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

Post by martin » 2010-11-30 09:55:22

Happy to help- I'm glad the macro works for you. Thank you for the donation Lou- that's very gracious! :)

Post Reply