Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

277
Views
Script de Photoshop: ¿nombre de salida de cada capa de nivel superior seleccionada?

Tengo un código Javascript de Photoshop de ActionReference que funciona aquí y escupe el nombre de cada capa seleccionada:

 var lyrs = []; var ref = new ActionReference(); ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt')); var targetLayers = executeActionGet(ref).getList(stringIDToTypeID('targetLayers')); for (var i = 0; i < targetLayers.count; i++) { var ref2 = new ActionReference(); ref2.putIndex(charIDToTypeID('Lyr '), targetLayers.getReference(i).getIndex() + 1); var desc = executeActionGet(ref2); lyrs.push(desc.getString(charIDToTypeID('Nm '))); } lyrs.join('\\n');

(Los uno en una cadena delimitada por una sola línea al final para usar en AppleScript, así que ignore esa parte por ahora).

Sin embargo, este código también incluye las capas anidadas (esto sucede cuando hace Mayús y hace clic en grupos de conjuntos de capas), y no estoy seguro de cómo modificar este código para ignorar esas capas anidadas de nivel inferior y solo mostrar la lista de los nombres de las capas de nivel superior.

Tengo mucha experiencia con AppleScript, pero soy un novato en JavaScript, ¡así que no me hagas caso!

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Lo descubrí: necesitaba incluir una línea sobre parentLayerID:

 var ref = new ActionReference(); sTT = stringIDToTypeID; ref.putEnumerated(sTT('document'), sTT('ordinal'), sTT('targetEnum')); var targetLayers = executeActionGet(ref).getList(sTT('targetLayers')); var lyrs = []; for (var i = 0; i < targetLayers.count; i++) { var ref2 = new ActionReference(); ref2.putIndex(sTT('layer'), targetLayers.getReference(i).getIndex() + 1); var desc = executeActionGet(ref2); desc.getInteger(sTT('parentLayerID')) < 0 && lyrs.push(desc.getString(sTT('name'))); } lyrs.join('\\n');
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!