Page 1 of 1

macro to strip out (delete) all footnotes

Posted: 2013-03-01 01:08:44
by NisusUser
How would I go about making a macro to delete all footnotes? I want the markers in the main text gone and the associated text at the bottom of the page. Probably I should have one for endnotes, too, or just one that does both.

Thanks.

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 02:34:14
by phspaelti
My version of Nisus comes with a pre-installed macro in the macro menu: "NoteConversions > Convert Footnotes to Inline Snippets"

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 06:10:43
by NisusUser
phspaelti wrote:My version of Nisus comes with a pre-installed macro in the macro menu: "NoteConversions > Convert Footnotes to Inline Snippets"
Well, Philip, mine apparently didn't. Under "Editing" in Macros I have "Convert Notes to text", but that's not what I want. I just want to totally eradicate them.

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 06:53:30
by phspaelti
Sorry, I misread what you wanted. If you want to remove the notes completely that is very easy. Put a Note marker in the find window, and nothing in the Replace box. Press (not hit :wink: [Martin] ) "Replace All" and they'll be gone.

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 07:01:41
by phspaelti
Sorry I spoke too soon! You can tell I work with Footnotes only once in a blue moon. I was pretty sure this method worked once. Right now I can't see how one gets a footnote marker into the Find window. Obviously this could be done with a macro, but I thought there was a simpler way.

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 07:15:03
by phspaelti
Well silly me. The easiest way to strip all footnotes, is to select one, use Select All (i.e. <command>-A) and then just delete. You will get a warning prompt, before it removes them.

But if you still want a macro, one can be provided.

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 07:16:37
by NisusUser
And silly me! I had no idea I could do that. But it works! Thanks!! Case closed. :)

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-01 07:34:05
by phspaelti
As for a macro the following works:

Code: Select all

while Select Next Note Reference
	Cut
end

Re: macro to strip out (delete) all footnotes

Posted: 2013-03-05 12:25:18
by martin
Thanks for all that help Philip. I think just placing the selection into any footnote/endnote area, using Select All, and then pressing delete is the easiest way to go.

In case it's useful, here's another macro that asks you which type of notes you want to delete, all footnotes or endnotes:

Code: Select all

$type = Prompt 'Delete all notes of what type?', 'Deleting endnotes will delete both section endnotes and document endnotes.', 'Footnotes', 'Endnotes'
If 'Footnotes' == $type
	$isDeleteFootnotes = true
Else
	$isDeleteFootnotes = false
End


Select Document Start
While Select Next Note Reference
	$selected = TextSelection.active
	$note = $selected.text.noteAtIndex($selected.location)
	$isFootnote = $note.placement == 'page'
	If $isFootnote == $isDeleteFootnotes
		Delete
	End
End