Script to select certain layer when opening documents?

Advocate ,
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

74

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

1 Correct Answer

Adobe Community Professional , Aug 21, 2020
rob day Adobe Community Professional , 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";    

Likes

Translate

Translate
Jump to answer Jump to answer
Adobe Community Professional ,
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";

 

 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
cbishop01 AUTHOR LATEST
Advocate ,
Aug 21, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
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

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more