Reply to topic  [ 4 posts ] 
Help needed: macro to replace ñ with – (en-dash) 
Author Message

Joined: 2006-12-08 00:46:44
Posts: 417
Location: London or Exeter, UK
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.


2008-02-18 06:30:50

Joined: 2007-03-03 09:55:06
Posts: 494
Location: Europe
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.


2008-02-18 12:26:34
Official Nisus Person
User avatar

Joined: 2002-07-11 17:14:10
Posts: 4251
Location: San Diego, CA
Henry's Find & Replace should work exactly as you need. As a macro it simply looks like:
Find and Replace '([0-9])ñ([0-9])', '\1-\2', 'Ea'

The 'Ea' means use PowerFind Pro and replace all matches.

2008-02-18 22:33:20
Profile WWW

Joined: 2006-12-08 00:46:44
Posts: 417
Location: London or Exeter, UK
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.



2008-02-19 04:47:18
Display posts from previous:  Sort by  
Reply to topic   [ 4 posts ] 

Who is online

Users browsing this forum: No registered users and 2 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:  
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software