Count footnotes?

Everything related to our flagship word processor.
Post Reply
PostGradDad
Posts: 2
Joined: 2014-12-21 18:08:48

Count footnotes?

Post by PostGradDad »

Does anyone know if there is a way to count the number of footnotes in a document, please?
Þorvarður
Posts: 474
Joined: 2012-12-19 05:02:52

Re: Count footnotes?

Post by Þorvarður »

PostGradDad wrote:Does anyone know if there is a way to count the number of footnotes in a document, please?
Here is a macro that will count the number of footnotes in your document.

Code: Select all

### How many footnotes are in my document? ###
# Based on the macro "Select Note References in Body" (by Kino?)

Require Application Version 3.1
$doc = Document.active
if $doc == undefined
	exit
end

$notes = $doc.allNotes
if ! $notes.count
	Exit 'No note found, exit...'
end

$text = $doc.text

$noteRefsInBody = Array.new

$count = 0
foreach $note in $notes
	$count = $count+1
end

If $count >1
	$texti1 = "In your document are "
	$texti2 = " footnotes."
		else
	$texti1 = "In your document is "
	$texti2 = " footnote."
end

$count = $count & $texti2

Prompt $texti1 & $count

### end of macro ###
PostGradDad
Posts: 2
Joined: 2014-12-21 18:08:48

Re: Count footnotes?

Post by PostGradDad »

Awesome! Many thanks, Þorvarður.
User avatar
phspaelti
Posts: 1360
Joined: 2007-02-07 00:58:12
Location: Japan

Re: Count footnotes?

Post by phspaelti »

While Þorvarður's will work fine, note that all the information required is contained in the single variable $doc.allNotes.count, so the following macro would be sufficient:

Code: Select all

$doc = Document.active
prompt $doc.allNotes.count
:wink:
philip
Þorvarður
Posts: 474
Joined: 2012-12-19 05:02:52

Re: Count footnotes?

Post by Þorvarður »

phspaelti wrote:all the information required is contained in the single variable $doc.allNotes.count
This is really nice. Thank you, Philip. Where would we be without you? :D

Happy New Year!
Post Reply