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

executemenucommand selectall doesn't select text

Explorer ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

I have a document with several artboards in it and I want to select all so I run this:

app.executeMenuCommand("selectall");

Unfortunately, this seems to only select the artwork items and not the text.

Am I doing something wrong or is there a better way to select everything?

 

Thanks

 

TOPICS
Scripting , SDK

Views

95

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
community guidelines

correct answers 2 Correct answers

Community Expert , Sep 13, 2022 Sep 13, 2022

Hi @Bernie5CFE 

app.executeMenuCommand("selectall");

 

The above command is used to select the artwork, if you want to select the text inside the textframe, you need to select() method on textRange as below

var _textFrame = app.activeDocument.textFrames[0];
_textFrame.textRanges[0].select();

 

The above code will select first charcter of the first textframe of the document.

Likes

Translate

Translate
Explorer , Sep 19, 2022 Sep 19, 2022

Thanks @Charu Rajput, you sent me in the right direction. 

In the end I ended up doing this:

this.selectAll();

for ( var i = 0; i < app.activeDocument.textFrames.length; i++ ) {
  app.activeDocument.textFrames[i].textRange.select(true)
}

Likes

Translate

Translate
Explorer ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Actually it is selecting some of the text just not everything - see the attached screen grab

 

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
community guidelines
Community Expert ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

go to layers, select the circle on the right, click to target everything including artboard.

 

Screen Shot 2022-09-13 at 10.05.02 PM.png

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
community guidelines
LEGEND ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

It looks like the text has been outlined. Is that correct?

Can you please expand "Layer 1" so content can be viewed?

 

@manal shanableh, That's a good way to manually select. I think @Bernie5CFE is wanting to do it in a script.

 

You can also try:

app.activeDocument.layers[0].hasSelectedArtwork = true;
This will select all on the specified layer ('0' being the index of the top layer).

 

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
community guidelines
Community Expert ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Hi @Bernie5CFE 

app.executeMenuCommand("selectall");

 

The above command is used to select the artwork, if you want to select the text inside the textframe, you need to select() method on textRange as below

var _textFrame = app.activeDocument.textFrames[0];
_textFrame.textRanges[0].select();

 

The above code will select first charcter of the first textframe of the document.

Best regards

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
community guidelines
Explorer ,
Sep 19, 2022 Sep 19, 2022

Copy link to clipboard

Copied

LATEST

Thanks @Charu Rajput, you sent me in the right direction. 

In the end I ended up doing this:

this.selectAll();

for ( var i = 0; i < app.activeDocument.textFrames.length; i++ ) {
  app.activeDocument.textFrames[i].textRange.select(true)
}

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
community guidelines