nisus.com
https://www.nisus.com/forum/

Macro: convert format markers to formatted text
https://www.nisus.com/forum/viewtopic.php?f=17&t=4916
Page 1 of 1

Author:  NisusUser [ 2012-04-17 21:56:57 ]
Post subject:  Macro: convert format markers to formatted text

I don't yet have any meaningful skills with Nisus WP's macros. (I'm using 2.0.2). I am testing Transcriva (http://www.bartastechnologies.com/products/transcriva/), attempting to transcribe a recording. Transcriva does not support bold, italic, or underlined text. I'm thinking that if, when transcribing, I inserted markers around text I'd like formatted, then when I export .rtf files, I could have a macro in NWP that would apply the formatting and remove the markers. I am thinking of markers like
Code:
[B]bold[/B] and [b]bold[/b],  [I]italics[/I] and [i]italics[/i], and [U]underline[/U],  [u]underline[/u]
How do I make a macro like this? Or does someone want to do one for me? :) Thanks!

Author:  phspaelti [ 2012-04-18 00:33:15 ]
Post subject:  Re: Macro: convert format markers to formatted text

Hello NisusUser.

writing such a macro is possible and is in fact quite easy. The key is to use "Find and Replace".
  1. Open "Find and Replace"
  2. Select "Using: PowerFind"
  3. Enter your opening tag, i.e.,
    Code:
    "[b]"
  4. From the gear menu choose Match > Capture(). The cursor should be between the two parts of the Capture()
  5. From the gear menu choose Wild Card > AnyCharacter
  6. From the gear menu choose Repeat > 1+ Shortest
  7. Place the cursor at the end of the find expression and enter your closing tag, i.e.,
    Code:
    "[/b]"
  8. Move to the Replace box and from the (replace) gear menu choose Match > Captured1
  9. Select the replace expression and apply bold formatting as usual. The "Replace Attributes" box should become "clicked"

The find box should look like this:
Attachment:
Macroize_1.jpg
Macroize_1.jpg [ 32.26 KiB | Viewed 4277 times ]


If you do "Replace All" now on a file with that kind of mark up you should have your mark up turned into formatting.
NB: Since "Ignore Case" is checked, this will work for tags with either "b" or "B" in any mixed combination. (This seems to be what you want.)

To get a macro, you do the following.

  1. From the gear menu choose "Macroize…"
    Attachment:
    File comment: choosing "Macroize…"
    Macroize_2.jpg
    Macroize_2.jpg [ 55.28 KiB | Viewed 4277 times ]
  2. In the macroize window specify "Replace All" and then do "Save as Macro"
    Attachment:
    File comment: Save as "Replace all" macro
    Macroize_3.jpg
    Macroize_3.jpg [ 33.46 KiB | Viewed 4277 times ]

Repeat the whole thing for the other tags. :!: Make sure to apply the formatting you want -- and to clear out any formatting you don't want -- in the replace box. :!:
You'll have to use copy/paste to combine the 3 macros into 1.

Author:  phspaelti [ 2012-04-18 00:34:45 ]
Post subject:  Re: Macro: convert format markers to formatted text

Anyhow here is a completed macro. (My version uses Powerfind Pro).

Attachment:
NisusUserTagToFormatting.nwm [18 KiB]
Downloaded 380 times

Author:  NisusUser [ 2012-04-18 09:24:53 ]
Post subject:  Re: Macro: convert format markers to formatted text

Thank you, Phillip! I'll try to work through the stuff you taught me, and see if I can learn how to do some of this for myself. I can foresee some other macros I need, so getting some skills in this area will be great. Thanks so much!

Page 1 of 1 All times are UTC - 8 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/