Skip to main content
Participant
July 5, 2021
Question

Selecting Top Layer using Javascript

  • July 5, 2021
  • 2 replies
  • 661 views

I am trying to combine action and script to do some task. There is a few text objects in different layers (Layer 01, Layer 02 etc.) What my plan is I want to select Layer 01 through scripting and the rest of the work will be done through action. How can I select the first layer (Layer 01) through javascript?

This topic has been closed for replies.

2 replies

Disposition_Dev
Legend
July 7, 2021

If you're looking to select the items on this layer, see femkeblanco's answer. However, if you're looking to just select the layer itself, this is probably an instance of the x/y problem. What does your action do after you select the layer?

Kazi5EF7Author
Participant
July 13, 2021

Thank you for your kind effort. After I select contents of a layer (not layer but contents of a layer) I will apply some predetermined task like outlining the text applying some effect etc.

Disposition_Dev
Legend
July 13, 2021

ok cool. Then femke's reply should be exactly what you need. 

femkeblanco
Legend
July 5, 2021

I presume you mean you want to select the items in layer Layer 01.

 

app.activeDocument.layers["Layer 01"].hasSelectedArtwork = true;