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

Script to select certain layer when opening documents?

Advisor ,
Aug 21, 2020 Aug 21, 2020

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
388
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 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";

 

 

Translate
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";

 

 

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

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

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

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

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