Search for paragraph attributes Space Before and Indents

Everything related to our flagship word processor.
Post Reply
bucephalusarp
Posts: 3
Joined: 2011-07-09 19:34:27

Search for paragraph attributes Space Before and Indents

Post by bucephalusarp »

Hi, I'm just starting a trial of Nisus 2 (I'm finally disgusted enough with MS Word to be looking seriously for an alternative). I'm impressed with so many things but one thing which seems like it should be doable is escaping me. Can I use the Find/Replace dialog to search for paragraph attributes such as a specific Space Before or Indent, so that I can then apply a Paragraph Style to all paragraphs with the attributes searched for. I understand that you can find attributes that you apply to the Find expression from the Format menu, but certain attributes like Space Before or Indents only seem to be available from the Palette, not from the Format menu. So I don't see how to set up the Find to look for those attributes. Can't it be done? Ultimately I'd like to be able to create macros from such a Find/Replace to process large files to select multiple paragraphs with various attributes mostly related to Space Before and After and Indents and apply 4-5 basic paragraph styles to them. I've also looked at how I might write a macro to do this without macroizing from the Find/Replace but writing complex macros myself seems fairly daunting at this point (wish there was a record macro function ...) . I'd appreciate any help or pointers to info on if this is possible in Nisus and how. Thanks.

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

Re: Search for paragraph attributes Space Before and Indents

Post by martin »

bucephalusarp wrote:I understand that you can find attributes that you apply to the Find expression from the Format menu, but certain attributes like Space Before or Indents only seem to be available from the Palette, not from the Format menu. So I don't see how to set up the Find to look for those attributes. Can't it be done?
This is partially true. The menus don't offer up as much flexibility as the palettes for some paragraph attributes, like spacing before paragraph, but you can still apply/adjust them. For example, with "space before", you can use the menu Format > Paragraph Spacing > Increase Space Before Paragraph. Those menus adjust the spacing in 2pt increments, so that may or may not meet your needs.
Ultimately I'd like to be able to create macros from such a Find/Replace to process large files to select multiple paragraphs with various attributes mostly related to Space Before and After and Indents and apply 4-5 basic paragraph styles to them.
I'll attach a template macro that should get you started. The template finds all paragraphs with a "before spacing" of 2pts, and applies the "Block Quote" paragraph style to them. If you want to change the search criteria, just select the first line of the macro and apply whatever paragraph attributes formatting/attributes you'd like. Let me know if you have any questions.
Attachments
Find All with 2pt Before Spacing.nwm
(17.75 KiB) Downloaded 145 times

bucephalusarp
Posts: 3
Joined: 2011-07-09 19:34:27

Re: Search for paragraph attributes Space Before and Indents

Post by bucephalusarp »

Thanks for the reply Martin.

1. OK, I've figured out how to search for Space Before attributes in the Find dialog, though unfortunately it's pretty clumsy to search for, say, a 12 pt space before (have to select Increase Space Before from the menu 6 times, and then tend to lose track of the count, and no indication in the Find box what the space before setting is).

2. Thanks also for the macro template. But based on the first line of your macro:

Find All '.+', 'Eu'

how do I set other amounts than 2 pts, eg. 4 pt or 12 pt? How to indicate space after? I also tried creating 2 macros from a Find for 2 pt space before and another for 4 pt space before and they both work as expected from the Find box and as macros but when I open the macros they are (or appear to be) both identical!?:

Find All '(Any)', 'eau'

And different from the expression in the macro you sent. The macro language certainly isn't very transparent, and I can't find any reference to these terms or paragraph attributes in the NWP documentation about Macros or the Macro Language Reference (also eg, what is 'Eu' vs 'Eau') So unfortunately I'm unclear about how to adapt the macro you sent or even how to go about learning the basics of the macro terms without asking an expert for the specifics for each thing I'd like to do (though if Nisus Support is offering to write macros for customers, that would be pretty terrific). Would appreciate if you could explain slightly more. Thanks.

User avatar
phspaelti
Posts: 1095
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Search for paragraph attributes Space Before and Indents

Post by phspaelti »

bucephalusarp wrote: 2. Thanks also for the macro template. But based on the first line of your macro:

Find All '.+', 'Eu'

how do I set other amounts than 2 pts, eg. 4 pt or 12 pt? How to indicate space after? I also tried creating 2 macros from a Find for 2 pt space before and another for 4 pt space before and they both work as expected from the Find box and as macros but when I open the macros they are (or appear to be) both identical!?:

Find All '(Any)', 'eau'

And different from the expression in the macro you sent.
The difference is in the attributes of the line in the macro file. So you can't see them here. Open the macro, place the cursor on the "Find All" line of the macro, and then check the settings in the formatting palette. You can easily change Martin's macro just by changing the attributes on that line of the macro.
philip

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

Re: Search for paragraph attributes Space Before and Indents

Post by martin »

bucephalusarp wrote:how do I set other amounts than 2 pts, eg. 4 pt or 12 pt? How to indicate space after?
As philip mentioned, you can check (and change) the spacing amounts using the palettes in the tooldrawer (in this case use the "Paragraph" palette).
I also tried creating 2 macros from a Find for 2 pt space before and another for 4 pt space before and they both work as expected from the Find box and as macros but when I open the macros they are (or appear to be) both identical!?
The reason you don't see the effect of the "spacing before" is because the find expression is the first paragraph in the document, where paragraph spacing before is not enacted upon (this is intentional). You could insert a paragraph just before the find expression so you can more easily see the paragraph spacing before; I'd recommend a comment (comments are any paragraph prefixed with a "#" character).
I can't find any reference to these terms or paragraph attributes in the NWP documentation about Macros or the Macro Language Reference (also eg, what is 'Eu' vs 'Eau')
I'm not going to claim the macro language is easy to learn, or that the Language Reference is good at teaching. I know it can be hard, but the information is there. All the Find/Replace command options (eg: "Eau") are documented under the heading Commands > Find and Replace. Each letter in the string turns on a different option. 'E' means PowerFind Pro, 'a' means Find/Replace all, and 'u' means attribute sensitive matching. You might also see the heading Find and Replace Examples a little later on; that should probably be rearranged just after the Find and Replace commands.

bucephalusarp
Posts: 3
Joined: 2011-07-09 19:34:27

Re: Search for paragraph attributes Space Before and Indents

Post by bucephalusarp »

Ahh, attributes applied in the macro affect what the macro does! Thanks Philip and Martin for the additional clarification, and sorry Martin, since you actually said that in your first reply but I misinterpreted it to mean I had to change the wording to change the attributes. And now that you've pointed me to the couple of places in the Reference, I'm starting to feel a glimmer of understanding. But I've been futzing with trying to get a couple attributes examples to work and only having partial success so far. For example, applying one of the attributes, eg, space before or indent, I can get it to identify the correct paragraphs, but when I apply more than one attribute the macro seems to only recognize one or the other of the attributes. So I'll keep plugging away. But it's a time and effort issue, I have done some coding before, I know you just have to be very patient, but ideally something like Photoshop Actions which is so simple to record and implement would be the model for any program that has macros/scripts. Funny, because I think I read on these forums that the OS9 version of Nisus had recordable, very easy to use macros that were lost with the transition to OSX. But I'm sure there's a gazillion things to juggle for any improvement to a program, and the real trick is not to get it all bloated and buggy as that occurs, and so much of Nisus is just a pleasure to work with, elegant, transparent, and powerful, that this one area seems surprisingly not like that. Oh, and one other thing I'd love for it to have: multiple windows for the same document, to be able to look at different parts of the document in different windows at the same time ...

Thank you both very much for your helpful replies.

Post Reply