• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with Kasyan's 'convert text to footnote' script

Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

I'm working with several long (100-250 pg.) documents that I need to import into InDesign for typesetting. Some of them have up to 700 footnotes in this form (it's markdown formatting)

Block quote[^1]

[^1]: Footnote text here

I found this awesome little script by @Kasyan Servetsky to convert these to "regular" InDesign footnotes, and it does the trick for smaller docs with 50-100 footnotes, but when I run it on my document with 700 footnotes it crashes with the following error:

23121922udmu_1-1647998174893.png

 

It seems like it's working, I saw it gather up all the footnote text and then I could see that it actually created ~700 of them, but when it gets to the end it crashes, and all the work is lost. 😞 Is there any way the script can be modified to work with a larger document?

 

TOPICS
Bug , Scripting

Views

532

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

I doubt that this crash would have something to do with the size of the document. Can you share with us a sample document that manifests this issue, along with the script you are using?

-Manan

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Unfortunately, I'm not free to share the original doc with 700 footnotes. 😞 But the script works fine on smaller docs with fewer footnotes, so I assumed it's crashing due to the large number of footnotes. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Oops, missed the link to the script. It's here:

http://kasyan.ho.ua/indesign/foot_end_note/convert_text_to_footnote.html

Looks like @Jump_Over is the original author, and @Kasyan Servetsky modified the script. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Why not contact Kasyan directly...  even if you pay for it.

The script seems to be working well on a long document (see my picture). Maybe something else in your text makes it fail at the end. He or some other script guru can give you an idea what this error message is about.



700 footnotes in a 365 pages documents700 footnotes in a 365 pages documents

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

How long does it take your script to run with 700 footnotes? @Jean-Claude Tremblay 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Less than a minutes... but it’s just text. I did it to show you it’s not the number of footnotes the problem.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

I don't know the script, but a common way to troubleshoot this type of issue is to (a) break up the 700 footnote document into n parts (eg. 2 parts) and then test the script on each part. If all divided parts work fine then it's a limitation of the script. If only some parts work it points more to something specific in the content. The more parts you make the more confidence you have that its the content vs the script operation.

- Mark

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Thanks, that's a good idea! Unfortunately, all of the footnote text is together at the end of the doc, so I'm not thinking of an easy way to divide the doc in half and still keep the relevant footnotes together. Let me see what I can do though. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

So I deleted the last half of the doc, keeping only the first pages up to footnote #300. The script runs a lot faster now, but right when it gets to the end it dies! 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Update: I pared the document down to 133 footnotes (just 26 pages) and deleted some tables, etc, that were messed up during the initial markdown import. And now the script works. So now I'm trying to figure out what is in the larger document that is causing the crash. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Check if you have some markdown inside tables.

The script don’t seems to be working when the footnotes marked text are presents in tables.
I just did a test and the script fail at the end. Even with a single page document.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Thanks, that's what I've been suspecting. But it's hard to find all the tables in a ~200 page document!! This helped, but I'm still finding more even after Find says "no more matches found". 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Even after deleting all tables from the original document, I still get the error when I run the script. 😞 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

Hi,
I just took a quick look at the script.

Please modify this:

 

app.doScript(PreCheck, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "\"" + scriptName + "\" script");

 

to this

 

PreCheck();

 

 
and you will hopefully get a more helpfull error message. Please post that one again.

Edit:
also: now it should fail but keeping the already created footnotes – so perhaps you even can see where exactly it fails and can maybe already figure out why.


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 22, 2022 Mar 22, 2022

Copy link to clipboard

Copied

You will able to solve the issue once you check the detailed guidelines about the project. Check it out now.

Also if you wish to buy stuff from best online furniture store in UK, check this out.

https://www.thelongeststay.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Thank you!! Now I hope we're getting somewhere. 🙂 Here's the new error message:

23121922udmu_0-1648041093033.png

I ran this on my "split" document that has only 300 footnotes, and it crashed at footnote #297, leaving the last 3 undone. (The numbers are there, but the footnote text was not inserted.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Hi @23121922udmu, here is something to try: modify the script by adding

if (!currFoot.isValid) continue;

to the line before line 46

mEndNotes.paragraphs[0].texts[0].move(LocationOptions.AT_END, currFoot.texts[0]);

This just skips when the story.footnotes[k] is invalid. If it runs with no error, you might be able to further troubleshoot by identifying k or just searching through the document to see where the footnote was not converted.

- Mark 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 25, 2022 Mar 25, 2022

Copy link to clipboard

Copied

Thanks, sorry for the delay in responding! I just get the same error as before. I'm noticing now though that the footnote numbers are getting mixed up... Footnote #736 is taking the text from #743, so somehow the numbers are getting out of sync. Looks like they first go out of sync here: (screenshot is from original .MD file) 

23121922udmu_0-1648223631126.png

The 2 "Ibid." footnotes just get skipped altogether, and then the numbering is off for the rest of the document. Is it possible the script is deleting the duplicates somehow?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 25, 2022 Mar 25, 2022

Copy link to clipboard

Copied

LATEST

Hold on... the missing footnotes problem is an issue with @Jongware's markdown import script.

23121922udmu_0-1648224471619.png

 

I just didn't notice it till the footnote script started acting up... 😞 Do I need to start a new thread for that issue? I have no idea how to diagnose that import script either. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

And when I run it on my full document, it gets to footnote #745 (out of 752) before it crashes with the same error as above. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 24, 2022 Mar 24, 2022

Copy link to clipboard

Copied

First question would be – what differs footnote #745 from #744 or #746?
Maybe like Uwe said – is it in a table?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Mar 25, 2022 Mar 25, 2022

Copy link to clipboard

Copied

I think the numbers are getting out of sync somehow, see my reply to @m1b above. So when it gets to the end, they don't match up, and the script crashes. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 23, 2022 Mar 23, 2022

Copy link to clipboard

Copied

Hi 23121922udmu,

I downloaded Kasyan's zip file that contains the script and two sample InDesign documents.

 

As far as I can see the sample documents are done with InDesign CC 2018.

A version where footnotes in tables were no option at all. That's a feature that was added later.

 

So I think that Kasyan's script will not handle footnotes in table cells at all.

It needs a rewrite.

 

Regards,
Uwe Laubender

( ACP )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines