macro: preserve some character attributes, but add italics
macro: preserve some character attributes, but add italics
I want to change [this] to this, or [this] to this, or [this] to this, i.e. text with brackets to italicized text. However, sometimes the target text in brackets already has bold, underline or such applied. All I want is to add italics. I'm using the PowerFind Pro find and replace formula in the attached screenshot. However, if the text has other attributes applied, it removed them and adds back italics only. How can I get want I need? Do I need to do separate find/replace functions for differing text, i.e. one for text already in bold, one for text already in bold & underline, one for text that has no attributes applied yet, etc.?
- Attachments
-
- imprecise find-replace_deletes formatting.png (28.09 KiB) Viewed 11480 times
Re: macro: preserve some character attributes, but add itali
I would use a macro for this. Then rather than do Find and Replace, I would do this:
So I'd just use the Find capability to Find things and then apply the formatting "by hand" (so to speak).
Hope this helps.
Code: Select all
Find All ...
Italic
Hope this helps.
philip
Re: macro: preserve some character attributes, but add itali
Philip,
I guess I don't know fully the difference between Find and Replace and a macro. I was just assuming a macro was a Find and Replace expression that was saved and run as a macro. Maybe you can help me out as to what you meant.
Attached is a macro I made to do this. For some reason it doesn't work, though. I thought I followed your examples. Would you be willing to help me out?
Thanks!
I guess I don't know fully the difference between Find and Replace and a macro. I was just assuming a macro was a Find and Replace expression that was saved and run as a macro. Maybe you can help me out as to what you meant.
Attached is a macro I made to do this. For some reason it doesn't work, though. I thought I followed your examples. Would you be willing to help me out?
Thanks!
- Attachments
-
EC-brackets to italics.nwm
- (823 Bytes) Downloaded 787 times
Re: macro: preserve some character attributes, but add itali
Hi I have fixed your macro.(Keeping my fingers crossed.) If you do it right then you don't need three Find/Replace statements. Your last one will suffice.
What does "do it right mean"? Well the attribute sensitive find/replace pays attention to the attributes. All the attributes. So once you paste the statement into a file it takes on other attributes (paragraph style, for example), and then it stops working. The solution for such cases is to use the "Remove Attributes and Styles" command, and then add back just the attributes you want.
to be continued…
What does "do it right mean"? Well the attribute sensitive find/replace pays attention to the attributes. All the attributes. So once you paste the statement into a file it takes on other attributes (paragraph style, for example), and then it stops working. The solution for such cases is to use the "Remove Attributes and Styles" command, and then add back just the attributes you want.
to be continued…
Last edited by phspaelti on 2012-11-29 05:13:39, edited 1 time in total.
philip
Re: macro: preserve some character attributes, but add itali
Anyhow I hate fussing with the attributes so I suggested a second method.
As I described above, you can use Find/Replace to select things, and then apply the styles you want. As long as the Find part doesn't care about styles, this works, a bit more "reliably".
A macro can contain more than just a list of Find/Replace statements. You can add any menu commands (just type them exactly as the menu name says), and then there is a whole macro language if you want to get really elaborate.
Anyhow good luck with your macro writing.
As I described above, you can use Find/Replace to select things, and then apply the styles you want. As long as the Find part doesn't care about styles, this works, a bit more "reliably".
A macro can contain more than just a list of Find/Replace statements. You can add any menu commands (just type them exactly as the menu name says), and then there is a whole macro language if you want to get really elaborate.
Anyhow good luck with your macro writing.

philip
Re: macro: preserve some character attributes, but add itali
Thank you very much for all your help and tutoring!