Hello
Can't seem to solve this problem. I have a large document with several thousand superscript footnote numbers. Many of these are the wrong side of a punctuation mark, e.g. word/superscript number/colon. I want to change these to word/colon/superscript number (and likewise with other punctuation marks). My find finds the superscript numbers very quickly and very well, however as soon as I ask it to find those that precede a punctuation mark it will find one but then the next will give me a spinning wheel for some time before subsequently crashing. The expression I am using in powerfind is Capture (AnyDigit 0+): -- this one being colons. The AnyDigit 0+ is attributively set for superscript - I have to use this because there are a lot of other normal, non-superscript numbers.
I am using NWP 1.1, leopard 10.5.3 on a MBP with 3gig.
Any assistance/advice greatly appreciated.
Thank you
Crashing with find and replace
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Crashing with find and replace
Hi Tony- after the crash can you restart NWP and send in a feedback report using the menu Help > Send Feedback? That will automatically include a crash log for us to look at. It may help to send in the document as well if you can. Thanks.
Re: Crashing with find and replace
1. Was the document converted from another application?Tony wrote:Can't seem to solve this problem. I have a large document with several thousand superscript footnote numbers. Many of these are the wrong side of a punctuation mark, e.g. word/superscript number/colon.[...]
2. Is there any right-to-left script language in the document?
If this is the case, there may be invisible directional marks which override the normal direction of the text. Replacing them with nothing corrects the order. You can find directional marks by entering the following expression in the 'Find what' box in PowerFind Pro:
[\u202c\u202e]+
Re: Crashing with find and replace
Try this macro.Tony wrote:I have a large document with several thousand superscript footnote numbers. Many of these are the wrong side of a punctuation mark, e.g. word/superscript number/colon. I want to change these to word/colon/superscript number (and likewise with other punctuation marks).
Code: Select all
$punct = ':;'
Require Application Version '3.1'
$punct = $punct.split ''
$doc = Document.active
if ! $doc.allNotes.count
Exit 'No note found, exit...'
end
$doc = $doc.copy
$doc.clearAndDisableUndoHistory
$text = $doc.text
$notes = $doc.allNotes
if $notes.lastValue.documentTextRange.bound == $text.length
$notes.pop
end
foreach $note in reversed $notes
$range = Range.new $note.documentTextRange.bound, 1
$nextChar = $text.subtextInRange $range
$isPunct = $punct.indexOfValue $nextChar
if $isPunct != -1
$text.replaceInRange $range, ''
$text.insertAtIndex $note.documentTextRange.location, $nextChar
end
end
Code: Select all
$punct = ':;'
Code: Select all
$punct = ':;\'\’'
That expression is wrong, which should be "(AnyDigit 1+):". However, even with a right expression and even if NW Pro did not crash, you could not find note references using the Find panel. That is a great shortcoming of NW Pro.The expression I am using in powerfind is Capture (AnyDigit 0+): -- this one being colons. The AnyDigit 0+ is attributively set for superscript - I have to use this because there are a lot of other normal, non-superscript numbers.
But perhaps those "thousand superscript footnote numbers" are not real footnote references? If so, the macro above won't solve the problem.
Re: Crashing with find and replace
Martin, Hamid and Kino, thank you very much for your support and assistance. Thanks to Kino's tip-off, I have managed to get it working by changing (AnyDigit 0+) to (AnyDigit 1+) inside the find. It now works perfectly. Many hours saved, so thank you.
- martin
- Official Nisus Person
- Posts: 5230
- Joined: 2002-07-11 17:14:10
- Location: San Diego, CA
- Contact:
Re: Crashing with find and replace
I'm glad you got it working Tony. However, I'd still be interested in seeing a feedback report after a crash, so we can see if there's anything we can fix in case others might run into the same issue. Thanks.
Re: Crashing with find and replace
Martin, have replicated crash and sent feedback and file.
Thanks again,
Tony
Thanks again,
Tony