Insert text after every table

New Here ,
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

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

TOPICS
Scripting

Views

666

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

Insert text after every table

New Here ,
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

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

TOPICS
Scripting

Views

667

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 11, 2012 0
Guide ,
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

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

Copy link to clipboard

Copied

Thank you Marc!

this works perfectly!

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, 2012 0
Contributor ,
Jan 04, 2021

Copy link to clipboard

Copied

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';

 

 

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