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

Overlapping Data Merge

Explorer ,
Aug 05, 2024 Aug 05, 2024

I am having trouble with variable-length data merges overlapping with each other.  It appears this is not a new thing, and was addressed (and solved) in this thread.  I have made a single text box formatted the way I would like.  The problem is that the script is not working for me.

 

The script should take the single-item merged documents and stitch them together.  When I run the script, I get the error "Error string: app is not defined."  I am a real beginner, so it's possible, I made a mistake with the script, but it was just a copy-paste thing... so I don't know.  I made a txt file with the .idjs extension with this as the text. 

function main(){
    var doc = app.documents.everyItem().getElements();
    var n = doc.length;
    if(!n){
        alert("You need a document");
        return;
    }
    doc = doc[0];
    var tfs = doc.pages.everyItem().textFrames.everyItem().getElements();
    n = tfs.length;
    while(n--){
        if(n==0) break;
        tfs[n].previousTextFrame = tfs[n-1];    
    }
}
var u;
app.doScript("main();", u, u, UndoModes.ENTIRE_SCRIPT, "Merge textframes");

But I get an error. 

 

Any help would be appreciated.

 

Thank you!

TOPICS
How to , Scripting
343
Translate
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

correct answers 1 Correct answer

Community Expert , Aug 05, 2024 Aug 05, 2024

Hi @Benjamin39010368auuu, it is an easy fix I hope. Just change the script's file extension to ".js" because the code is ExtendScript, not UXP.

- Mark

Translate
Community Expert ,
Aug 05, 2024 Aug 05, 2024

Hi @Benjamin39010368auuu, it is an easy fix I hope. Just change the script's file extension to ".js" because the code is ExtendScript, not UXP.

- Mark

Translate
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
Explorer ,
Aug 06, 2024 Aug 06, 2024
LATEST

Easy fix indeed! Thanks for the help!

Translate
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