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

How to select and copy

Contributor ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Hi experts,

Assume my active doc has only one story, my goal is to select the text and copy.

How I can do that?

my script like this:

var mySource = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements();

       mySource.select();

app.copy();

but not working.

Could someone show me how please.

thanks

Regard

John

TOPICS
Scripting

Views

494

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

Community Expert , Jan 06, 2017 Jan 06, 2017

Hi John,

if your document contains only one single story use just that story and its texts property:

var doc = app.documents[0];

var story = doc.stories[0];

doc.select(story.texts[0]);

app.copy();

EDIT:

You cannot select the text of several stories at one time.

InDesign is not able to do that.

Regards,
Uwe

Votes

Translate

Translate
Guest
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

var mySource = app.activeDocument.stories.everyItem().paragraphs.everyItem().getElements(); 

for(var i=0; i<mySource.length; i++)   

{   

    mySource.select() 

   

//~      app.cut() 

//~      app.paste()  

}

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 ,
Jan 06, 2017 Jan 06, 2017

Copy link to clipboard

Copied

Hi John,

if your document contains only one single story use just that story and its texts property:

var doc = app.documents[0];

var story = doc.stories[0];

doc.select(story.texts[0]);

app.copy();

EDIT:

You cannot select the text of several stories at one time.

InDesign is not able to do that.

Regards,
Uwe

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
Contributor ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

thank you guys

thank you so much.

regard

John

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 ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

Hi John,

what do you like to do with the copied story?

Story objects do have a duplicate() method:

Adobe InDesign CS6 (8.0) Object Model JS: Story

Regards,
Uwe

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
Contributor ,
Jan 07, 2017 Jan 07, 2017

Copy link to clipboard

Copied

LATEST

thank you Wue

thank so much.

Regard

John

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