Find style not working

Get help using and writing Nisus Writer Pro macros.
Post Reply
brsnyder
Posts: 19
Joined: 2015-06-26 23:30:40

Find style not working

Post by brsnyder »

Hi --

I duplicated the macro "Find all and show context" (after I updated it so it worked) and edited it so the Find expression is a style. The dialog box pops up and shows that I want to find

Character Style "xref"

which is correct. There are 3 chunks of text in my document with this style. But it is saying there are no matches.

The statement where I set the Find expression is:

$findExp = $doc.styleWithName 'xref'

I've tried with both paragraph and character styles and still no results. Am I doing something wrong, or does this feature not really exist as documented?

"As of v2.0.5 the findText argument can also be a Style object instead of some text. If a style is given, then will match any text with that style applied."

I'm using 2.1.1.

Thanks -- Barbara
brsnyder
Posts: 19
Joined: 2015-06-26 23:30:40

Re: Find style not working

Post by brsnyder »

Well after much trial and error, I figured out that the Find box was set on Normal and it needed to be on one of the PowerFind settings. So I added that to the macro and it works.
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Find style not working

Post by phspaelti »

Glad to see that you got it working. Just for info purposes you might take a look at the following macro:
http://www.nisus.com/forum/viewtopic.ph ... 078#p25078
philip
brsnyder
Posts: 19
Joined: 2015-06-26 23:30:40

Re: Find style not working

Post by brsnyder »

I kind of did that. I used the "Find all and show context" and modified it to "Find all xref style and show context." The extra step of adding the xref style is the piece I had to figure out. I'm coming from FrameMaker, where you can search directly for xrefs. So I'll just have to remind myself (or create another macro!) to apply the style when I create the xref.

Thanks -- Barbara
Post Reply