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

Insert text after every table

New Here ,
Sep 11, 2012 Sep 11, 2012

Copy link to clipboard

Copied

Hi,

I want to add 3 linebreaks after every table in my document. Then i want to convert the tables to text (sorry, but it makes sense for some export reasons  ;-)).

Step 2 i got with: "app.activeDocument.stories.everyItem().tables.everyItem().convertToText("\t", "\r");"

But i can't find out how i place a text-insert with '\r\r\r' after every table (before step 2).

many thanks for your help

TOPICS
Scripting

Views

905

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

correct answers 1 Correct answer

Guide , Sep 11, 2012 Sep 11, 2012

Hi,

An approach is to loop through insertion points using the storyOffset property of the tables:

// Get the array of tables' insertionPoints

// ---

var ips = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset,

    i = ips.length;

while( i-- )

    with( ips.insertionPoints.nextItem(ips) )

        isValid && contents = '\r\r\r';

@+

Marc

Votes

Translate

Translate
Guide ,
Sep 11, 2012 Sep 11, 2012

Copy link to clipboard

Copied

Hi,

An approach is to loop through insertion points using the storyOffset property of the tables:

// Get the array of tables' insertionPoints

// ---

var ips = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset,

    i = ips.length;

while( i-- )

    with( ips.insertionPoints.nextItem(ips) )

        isValid && contents = '\r\r\r';

@+

Marc

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 ,
Sep 11, 2012 Sep 11, 2012

Copy link to clipboard

Copied

Thank you Marc!

this works perfectly!

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
Engaged ,
Jan 04, 2021 Jan 04, 2021

Copy link to clipboard

Copied

LATEST

M. Marc,

 

Could you please help me to use this secript? (Mac, ID 2021)

 

Thanks.

 

as the result is Error 21/undefined is not an object:

with( ips.insertionPoints.nextItem(ips) )

 

Your script:

// Get the array of tables' insertionPoints
// ---
var ips = app.activeDocument.stories.everyItem().tables.everyItem().storyOffset,
i = ips.length;
while( i-- )
with( ips.insertionPoints.nextItem(ips) )
isValid && contents = '\r\r\r';

 

 

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