Reply to topic  [ 4 posts ] 
Macro: convert format markers to formatted text 
Author Message

Joined: 2011-01-12 05:32:38
Posts: 256
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!


2012-04-17 21:56:57
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
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 4265 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 4265 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 4265 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.

_________________
philip


Last edited by phspaelti on 2012-04-18 00:48:20, edited 4 times in total.



2012-04-18 00:33:15
Profile
User avatar

Joined: 2007-02-07 00:58:12
Posts: 876
Location: Japan
Anyhow here is a completed macro. (My version uses Powerfind Pro).

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

_________________
philip


2012-04-18 00:34:45
Profile

Joined: 2011-01-12 05:32:38
Posts: 256
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!


2012-04-18 09:24:53
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software