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

executemenucommand selectall doesn't select text

Explorer ,
Sep 13, 2022 Sep 13, 2022

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
1.1K
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 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.

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)
}
Translate
Adobe
Explorer ,
Sep 13, 2022 Sep 13, 2022

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

 

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

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

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

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).

 

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
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.

Best regards
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 ,
Sep 19, 2022 Sep 19, 2022
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)
}
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