Help needed: macro to replace ñ with – (en-dash)

Get help using and writing Nisus Writer Pro macros.
Post Reply
Posts: 425
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Help needed: macro to replace ñ with – (en-dash)

Post by xiamenese » 2008-02-18 06:30:50

Can someone help me please. I have encountered a glitch in the workflow Scrivener --> Exported RTF --> Bookends scan --> NWP.

Scrivener uses the Apple text engine -- the same problem arises with TextEdit -- and exports en-dashes as Hex '96. NWP can read that OK, but when scanned with Bookends, the en-dashes appear converted to ñ when the resulting file is opened in NWP, as that is the glyph for '96 in the coding used by Bookends. Bookends and Nisus apparently output RTF with /endash as the coding.

This is of particular concern in marking number ranges such as page-ranges in footnotes. So what I would like is a macro that will go through a file and replace all instances of ñ occurring between numbers with –

I am not a programmer and have no knowledge of any of the languages used for NWP macros, nor currently do I have time to start teaching myself. So I was wondering if there is any kindly soul out there who could and would be willing to help put together what I can only think must be a pretty simple macro.

Many thanks.


Posts: 496
Joined: 2007-03-03 09:55:06
Location: Europe

Post by Groucho » 2008-02-18 12:26:34

You can do this with Find/Replace using PowerFind Pro

1) Enable PowerFind Pro
2) In the Search box, type: ([0-9])ñ([0-9])
3) In the Replace box, type: \1-\2

This should work OK.


User avatar
Official Nisus Person
Posts: 4423
Joined: 2002-07-11 17:14:10
Location: San Diego, CA

Post by martin » 2008-02-18 22:33:20

Henry's Find & Replace should work exactly as you need. As a macro it simply looks like:

Code: Select all

Find and Replace '([0-9])ñ([0-9])', '\1-\2', 'Ea'
The 'Ea' means use PowerFind Pro and replace all matches.

Posts: 425
Joined: 2006-12-08 00:46:44
Location: London or Exeter, UK

Post by xiamenese » 2008-02-19 04:47:18

Thank you Henry and Martin.

I use PowerFind Pro by default and knew I could do it in that, but I was thinking of a macro that I could allocate a keystroke combination to so that I wouldn't have to enter the string into Find and Replace each time I wanted to run it, which would not be at highly regular intervals to the extent that I would have to think about the grep code each time.

Thank you for the macro, Martin. I shall try installing it.



Post Reply