Whenever I try to run this script in a document containing the following styling and text:
It generates the following error:
In all my documents, footnote text is marked in the same way and the text is usually at the end of the document. Though, the script worked for one of the documents however, it did not work for all others.
Could anyone help me with the idea of actually what is going wrong with the script? I have faced this problem in more than one file and have no idea about scripting.
Any help would be much appreciated.
Thanks and Regards,
[This post moved from InDesign forum to InDesign Scripting forum by Moderator]
First thing to do, when you're debugging, is to change the doScript in line 5 to a simple function call. In your case, change line 5 to
That way, when you're shown an error message, it will say on what line the error message is and give specific details. With doScript, you only get the unhelpful message that is shown now.
So do that and post back.
Looking quickly at the script, though, it seems to copy out certain types of paragraphs, but it also seems to assume that each paragraph it copies ends with a paragraph return. This might not always be the case, if the para is at the end of story.
So when you later loop through all (newly created) footnotes, you're assuming you'll find that many paragraphs, and it could be you won't.