Highlighted

Inserting footnotes back into the text flow with and adding a different formatting

New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

hi

is there a way to insert footnotes back into the text flow and it should only have a different para style etc.?

thanks

Today! …

 

/*
    _FRIdNGE-0650_FootnoteToText.jsx
    written by FRIdNGE, Michel Allio [10/09/2020]
*/

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Footnote To Text! …");

function main()
    {
        
        var myDoc = app.activeDocument,
        myFootnotes = myDoc.stories.everyItem().footnotes.everyItem().getElements();
        if (myFootnotes.length == 0 ) {
            alert( "No Footnote! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )
            exit();
        }
        var myCondition = myDoc.conditions.item("Footnote");
        if ( !myCondition.isValid ) var myCondition = myDoc.conditions.add ({name: "Footnote", indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor: [150,250,150]});
        for ( var f = myFootnotes.length-1 ; f >= 0 ; f-- ) {
            var myFootnote = myFootnotes[f].convertToText();
            myFootnote.texts[0].appliedConditions = [myCondition];
            myFootnote.contents = " [" + myFootnote.contents + "]";
        }
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\r";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.changeTo = " ";
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\[|\\]";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = " (?=\\[)";
        app.findGrepPreferences.appliedConditions = [myCondition];
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        app.changeGrepPreferences.appliedConditions = []; 
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        
        alert( "Done! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )

    }

 

(^/)

TOPICS
Scripting, Type

Views

114

Likes

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

Inserting footnotes back into the text flow with and adding a different formatting

New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

hi

is there a way to insert footnotes back into the text flow and it should only have a different para style etc.?

thanks

Today! …

 

/*
    _FRIdNGE-0650_FootnoteToText.jsx
    written by FRIdNGE, Michel Allio [10/09/2020]
*/

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Footnote To Text! …");

function main()
    {
        
        var myDoc = app.activeDocument,
        myFootnotes = myDoc.stories.everyItem().footnotes.everyItem().getElements();
        if (myFootnotes.length == 0 ) {
            alert( "No Footnote! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )
            exit();
        }
        var myCondition = myDoc.conditions.item("Footnote");
        if ( !myCondition.isValid ) var myCondition = myDoc.conditions.add ({name: "Footnote", indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor: [150,250,150]});
        for ( var f = myFootnotes.length-1 ; f >= 0 ; f-- ) {
            var myFootnote = myFootnotes[f].convertToText();
            myFootnote.texts[0].appliedConditions = [myCondition];
            myFootnote.contents = " [" + myFootnote.contents + "]";
        }
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\r";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.changeTo = " ";
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\[|\\]";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = " (?=\\[)";
        app.findGrepPreferences.appliedConditions = [myCondition];
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        app.changeGrepPreferences.appliedConditions = []; 
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        
        alert( "Done! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )

    }

 

(^/)

TOPICS
Scripting, Type

Views

115

Likes

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
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

To insert a footnote into the text:

  1. Copy the footnote text
  2. Type > Insert Footnote
  3. Type the text or use Edit > Paste or Edit > Paste Unformatted Text

 

As for the paragraph style, you can set the style for all footnotes in Type > Document Footnote Options.

 

You can manually assign a different style at any time. 

 

~Barb 

 

note.gif

Likes

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
Reply
Loading...
Sep 09, 2020 0
New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

thanks!

that would help for a few footnotes, I am talking about a document with
hundreds of footnotes that I want to move them back to the text flow, and
just change their style.

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

If you have removed footnotes from the InDesign file, you will need to add them back in, one at a time. 

 

If they are in the original Word document, you can re-place the Word file with the notes and they will be in the InDesign file, in the correct locations. Note that you will lose edits and formatting made since originally placing the file. If you can revert back to the version that had the notes, that might be best. (This is why we recommend incremental backups.)

 

To edit the footnote style, create and assign the style in Type > Document Footnote Options, then define the style attributes in the Paragraph styles panel. 

 

~Barb 

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Wait. Did you remove the footnotes, or are they placed as endnotes at the end of the document? If that's the situation, you can use Type > Convert Footnotes and Endnotes:

Screen Shot 2020-09-09 at 11.47.36 AM.png

 

~Barb 

Likes

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
Reply
Loading...
Sep 09, 2020 0
New Here ,
Sep 09, 2020

Copy link to clipboard

Copied

sorry for not explaining my problem correctly.

What I need to do is take all footnotes from a given document and move them
back into the main text flow (it should be as regular text not as footnotes
- move the footnotes into the story).

thanks

Likes

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
Reply
Loading...
Sep 09, 2020 0
Advocate ,
Sep 09, 2020

Copy link to clipboard

Copied

Likes

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
Reply
Loading...
Sep 09, 2020 1
Advocate ,
Sep 10, 2020

Copy link to clipboard

Copied

Today! …

 

/*
    _FRIdNGE-0650_FootnoteToText.jsx
    written by FRIdNGE, Michel Allio [10/09/2020]
*/

app.doScript("main()", ScriptLanguage.javascript, undefined, UndoModes.ENTIRE_SCRIPT, "Footnote To Text! …");

function main()
    {
        
        var myDoc = app.activeDocument,
        myFootnotes = myDoc.stories.everyItem().footnotes.everyItem().getElements();
        if (myFootnotes.length == 0 ) {
            alert( "No Footnote! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )
            exit();
        }
        var myCondition = myDoc.conditions.item("Footnote");
        if ( !myCondition.isValid ) var myCondition = myDoc.conditions.add ({name: "Footnote", indicatorMethod: ConditionIndicatorMethod.USE_HIGHLIGHT, indicatorColor: [150,250,150]});
        for ( var f = myFootnotes.length-1 ; f >= 0 ; f-- ) {
            var myFootnote = myFootnotes[f].convertToText();
            myFootnote.texts[0].appliedConditions = [myCondition];
            myFootnote.contents = " [" + myFootnote.contents + "]";
        }
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\r";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.changeTo = " ";
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = "\\[|\\]";
        app.findGrepPreferences.appliedConditions = [myCondition]; 
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        app.findGrepPreferences.findWhat = " (?=\\[)";
        app.findGrepPreferences.appliedConditions = [myCondition];
        app.changeGrepPreferences.appliedCharacterStyle = myDoc.characterStyles[0];
        app.changeGrepPreferences.appliedConditions = []; 
        myDoc.changeGrep();
        app.findGrepPreferences = app.changeGrepPreferences = null;
        
        alert( "Done! … ;-)\r\rby FRIdNGE, Michel Allio [10/09/2020]" )

    }

 

(^/)

Likes

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
Reply
Loading...
Sep 10, 2020 1
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

Thanks, it works and made my work really easier I greatly appreciate it!!!

 

Is there a way that you can add too the script that the moved footnotes should have a own character or paragraph style?

 

Thanks

Likes

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
Reply
Loading...
Sep 11, 2020 0
Advocate ,
Sep 14, 2020

Copy link to clipboard

Copied

You could simply add such a line:

 

app.changeGrepPreferences.appliedCharacterStyle = "FRIdNGE";

 

in the first Find/Replace, supposing your char style name is "FRIdNGE"!

 

If problem, let's continue in private!

 

(^/) 

Likes

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
Reply
Loading...
Sep 14, 2020 0
FRIdNGE LATEST
Advocate ,
Sep 15, 2020

Copy link to clipboard

Copied

Hi!

 

Change the loop as:

 

        for ( var f = myFootnotes.length-1 ; f >= 0 ; f-- ) {
            var myFootnote = myFootnotes[f].convertToText();
            myFootnote.texts[0].appliedConditions = [myCondition];
            myFootnote.texts[0].appliedCharacterStyle = "FRIdNGE"; // accessory demand! ;-)
            myFootnote.contents = " [" + myFootnote.contents + "]";
        }

 

… and, as you posted your question too on InDesignSecrets web-forum without answer (!),

 

https://indesignsecrets.com/topic/inserting-footnotes-back-into-text-flow-with-different-formatting

 

… thanks to mention someone helped you elsewhere [indicating this post link -- you could even say "Hello! …" for me to its boss David Blatner!  😉 ]

 

(^/)

Likes

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
Reply
Loading...
Sep 15, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Perhaps this can be handled via scripting, but it is not a feature that is built into InDesign.

 

I'll add the scripting tag to your post so that the scripters will find it. As a heads up, they will likely charge you to create a script to accomplish this task. Otherwise, it's back to copy and paste.

 

~Barb

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 09, 2020

Copy link to clipboard

Copied

Hi,

You can try like this and after converting footnotes you can apply other styles or anything else.

Currently I am applying conditional text through code.

/////////////////////////////////////////////////////////////////////////////////

var myDoc = app.documents[0];
for(var s = 0; s < myDoc.stories.length; s++){
    while(myDoc.stories[s].footnotes.length > 0){
        var footnoteText = myDoc.stories[s].footnotes[0].convertToText();
        myDoc.recompose();
        if(!myDoc.conditions.item("footnotes").isValid){
            var myCondition = myDoc.conditions.add();
            myCondition.name = "footnotes";
            }
        else{
            var myCondition = myDoc.conditions.item("footnotes");
            }
        footnoteText.texts[0].appliedConditions = myDoc.conditions.item("footnotes");
        }
    }

/////////////////////////////////////////////////////////////////////////////////

Best

Sunil

Likes

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
Reply
Loading...
Sep 09, 2020 0
Adobe Community Professional ,
Sep 11, 2020

Copy link to clipboard

Copied

Couldn't you understand this code?

Likes

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
Reply
Loading...
Sep 11, 2020 0
New Here ,
Sep 11, 2020

Copy link to clipboard

Copied

thanks, I actually tried it and it works, but michel's works faster

Likes

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
Reply
Loading...
Sep 11, 2020 0