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

Script to select certain layer when opening documents?

Advocate ,
Aug 21, 2020 Aug 21, 2020

Copy link to clipboard

Copied

Is there a script or line of code that can select a layer when opening a document (every document we open)?

 

app.addEventListener( "afterOpen", doSl );

//>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> Selects test when opening document <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\\      

function doSl(){
       
        app.activeDocument.layers.item("Test").select = true;

       }    
TOPICS
Scripting

Views

227

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 , Aug 21, 2020 Aug 21, 2020

A Layer doesn’t have a select property, so I think you want to set the document’s activeLayer. Try:

 

 

 

app.activeDocument.activeLayer = "Test";

 

 

Votes

Translate

Translate
Community Expert ,
Aug 21, 2020 Aug 21, 2020

Copy link to clipboard

Copied

A Layer doesn’t have a select property, so I think you want to set the document’s activeLayer. Try:

 

 

 

app.activeDocument.activeLayer = "Test";

 

 

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
Advocate ,
Aug 21, 2020 Aug 21, 2020

Copy link to clipboard

Copied

LATEST

I was trying to make it far to difficult. This worked perfect thanks a ton. 🙂

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 ,
Aug 21, 2020 Aug 21, 2020

Copy link to clipboard

Copied

You can place this script in the startup folder and it shall automatically run at the startup. Some additions to be added into this would be to add a #targetengine at the top of the script.

-Manan

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