help constructing (any) NWP macro

Get help using and writing Nisus Writer Pro macros.
Post Reply
Candace
Posts: 83
Joined: 2004-06-25 11:06:43

help constructing (any) NWP macro

Post by Candace » 2010-05-13 15:39:46

Long ago, Nisus Classic allowed you to do something, then capture the keystrokes in a macro. NWP won't do that, I know, but the manual says I just have to give it a "to do list." HA!
I would like two things: 1) instructions on how to create the particular macro I will discuss; 2) a methodology to determine how to create other macros. I have no idea what NWP will understand and what it won't. (P.S. I've reviewed 5 pages of macro topics and the manual).

The particular macro I want would find all instances of "People v. [insert any word here" and italicize the entire phrase.
I have tried to start small, by asking Nisus to "find (first line) all "People" (second line) Italic. (third line). When I try to run the macro, NWP tells me that it cannot recognize the term "People." How do I communicate that I want that specific word?
Worse, how will I communicate that I want the wild card word that follows "v." ?

I really really really miss my ability to create macros in Nisus Classic.

Thank you. Candace

User avatar
Hamid
Posts: 734
Joined: 2007-01-17 03:25:42

Re: help constructing (any) NWP macro

Post by Hamid » 2010-05-14 01:34:05

Candace wrote:[...]The particular macro I want would find all instances of "People v. [insert any word here" and italicize the entire phrase.[...]
You can save this expression as a Nisus Writer macro (with extension nwm):

Code: Select all

Replace All 'People v. (?:\\b\\w+\\b)', '\\0', 'EU'
Before saving the expression, apply the Italic attribute to '0' from the Format menu. The 'U' at the end of the expression means that the replacement text is attribute sensitive. Any other attribute applied to '0' will be applied to the replacement text.

Candace
Posts: 83
Joined: 2004-06-25 11:06:43

Re: help constructing (any) NWP macro

Post by Candace » 2010-05-14 10:44:49

Very cool --- it worked! (I had to take out the formatting, then save in the font I use, or else it transformed the italicized text into the font you used -- but that's not a big deal.)
Thank you so much!. Now can someone tell me how Hamid did this, so I can do it myself? Because I thought that the ability (for non programmers) to create macros was a big selling point for NWP, but that set of expressions Hamid used certainly is beyond my (current) ken.

For instance, I would like to adapt the macro to apply to all instances of "In re [wild card]," but since I don't know how it was constructed, I don't know how to do it.

Thanks again. Candace

Candace
Posts: 83
Joined: 2004-06-25 11:06:43

Re: help constructing (any) NWP macro

Post by Candace » 2010-05-14 10:53:54

OMG, OMG! I just used the Nisus Template for Find and Replace and a glimmer of understanding is lightening my darkness. Thanks again, Hamid. Cheers, Candace

Candace
Posts: 83
Joined: 2004-06-25 11:06:43

Re: help constructing (any) NWP macro

Post by Candace » 2010-05-14 11:38:22

One more question --- I opened the template for find and replace in a new doc, inserted the terms I wanted, saved it as a macro, and it worked. But when I go to open it, I get a dialogue box that says Nisus doesn't recognize the application that created it (!).

I tried doing it all again and saving as rtf. first, then saving as macro, but got the same message when I tried to open the macro to edit it.

It works fine, so maybe it's not a problem == but it seems as though I'm doing something wrong. Thanks. Candace

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

Re: help constructing (any) NWP macro

Post by martin » 2010-05-17 14:34:59

Candace wrote:Now can someone tell me how Hamid did this, so I can do it myself?
One handy tool is the Macroize feature in NWP's Find & Replace dialog. Just click the little "gear" icon and choose "Macroize" from the popup menu to turn the current Find & Replace dialog settings into a macro.

As for learning PowerFind (text patterns), you might want to consult our user guide, or the internet at large. If you switch NWP to PowerFind Pro mode, you can use regular expressions, which are documented many places.
Because I thought that the ability (for non programmers) to create macros was a big selling point for NWP, but that set of expressions Hamid used certainly is beyond my (current) ken.
Writing detailed macros for the novice won't be that easy, there's lots of information to put together. But if you're just doing some replacements you should be able to manage- feel free to ask us any questions that come up!

One resource to consult is the Macro Language Reference, available in NWP's Help menu. As has been pointed out before, it's not that helpful for beginners, but it may be invaluable as a reference.
I get a dialogue box that says Nisus doesn't recognize the application that created it
That's very odd, but is it NWP itself saying that, or the Finder? Perhaps you could send me a sample file?

Oh, one tip: if you hold down the Command key when you choose a macro from the menu, it will be opened for editing.

Candace
Posts: 83
Joined: 2004-06-25 11:06:43

Re: help constructing (any) NWP macro

Post by Candace » 2010-05-17 14:39:41

Thank you, Martin. I will try the Macroizing button. Cheers, Candace

Post Reply