Convert Bold and Italics to normal

Get help using and writing Nisus Writer Pro macros.
Post Reply
davidrcalvert
Posts: 28
Joined: 2014-07-18 18:32:13

Convert Bold and Italics to normal

Post by davidrcalvert »

Hi ,
I have two question.

For a rind and Replace you can make a selected word Bold or italics .

How can you do the opposite. Is there a not command or special syntax. To get a bold or italic word without those formats?

Also if you macroize in Find and Replace you have two separate macros one for find and one for replace . Do you merge them?

Or what is most efficient way to wind up with one macro not two?

Thanks,

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

Re: Convert Bold and Italics to normal

Post by phspaelti »

davidrcalvert wrote:Hi ,
I have two question.

For a rind and Replace you can make a selected word Bold or italics .

How can you do the opposite. Is there a not command or special syntax. To get a bold or italic word without those formats?
It's true that you can use Find and Replace to change styles, but I actually prefer a slightly different method. I use Find, but then I apply (or remove) the styles with menu commands. So:

Code: Select all

Find all …
Bold
Now actually this code has one small problem. If the Find is unsuccessful, the Bold will apply to whatever was selected before. To avoid this, write:

Code: Select all

if Find all '.+', 'Eau'
Bold
end
NB: styles applied to the find expression as needed.
Also if you macroize in Find and Replace you have two separate macros one for find and one for replace . Do you merge them?

Or what is most efficient way to wind up with one macro not two?
The macroize function has an option to "Copy to clipboard". So I usually use that for the second, third, etc. find statement. Of course, once you get more familiar with the Find syntax, you can just write them into the macro directly :)
philip
User avatar
phspaelti
Posts: 1313
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Convert Bold and Italics to normal

Post by phspaelti »

davidrcalvert wrote:Also if you macroize in Find and Replace you have two separate macros one for find and one for replace . Do you merge them?
Or what is most efficient way to wind up with one macro not two?
Actually, now that I re-read this question, i'm a bit confused; what do you mean 'one for Find and one for Replace'? The macroize function allows you to choose among several options ('Find Next', 'Find Previous', etc.). If you want to do a Find and Replace in one go you just choose 'Replace All', which will give you a 'Find and Replace'. Note that the Find dialog, somewhat confusingly, puts the macroize command in both drop down menus: next to the Find box and next to the Replace box. But they both give you the same options, and the result of macroizing is the same in both cases.

But if you want to do several Find and Replace commands in sequence, then my earlier advice applies.
philip
davidrcalvert
Posts: 28
Joined: 2014-07-18 18:32:13

Re: Convert Bold and Italics to normal

Post by davidrcalvert »

I understand the Find and Replace part of Macroize now. Thanks for the info.

However on a general note I understand how to make a macro to change text to bold and italics but how do you change the existing Bold or Italicized text to normal Not Bold or not Italics?

In general is there a macro syntax that would be used such as not format.

Hope that makes sense.


Thanks,

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

Re: Convert Bold and Italics to normal

Post by phspaelti »

davidrcalvert wrote:However on a general note I understand how to make a macro to change text to bold and italics but how do you change the existing Bold or Italicized text to normal Not Bold or not Italics?

In general is there a macro syntax that would be used such as not format.
There isn't really a "general" way to unformat text, but there are actually a whole number of ways. For a start Bold and Italic are toggle settings, so you can just apply them again to remove them. This is probably the best way when you want to want to remove one of them and not affect the other. Of course to make sure they turn the relevant setting 'off', you would need a Find statement to make sure to select only the part where the setting is 'on'. That was the point of the macro that I explained above.

But there are other ways. The "Font Face" submenu also has a "Regular" option which can be used directly to go to 'off'. This will turn off both Italic and Bold at the same time.
In general if you want to remove all forms of formatting you can use the command "Remove Attributes except Styles".
Another method is to use styles to cancel out certain combinations. The style should have the attributes you want to remove; apply the style then remove it.

And finally one can write macros with the macro language to manipulate styles, although this is unfortunately not as straightforward as it could be, and in the end I think amounts to using the same menu commands.
philip
Post Reply