Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

74
Vistas
Photoshop Script Select all visible Artboards

I've been trying to find a way to select all visible artboards, so i can later Quick Export them all as PNGs. I'd also love if i've could also include the exporting part inside the script, but that's not the main problem now.

I have this code that finds all the visibile artboards and stores them inside visibleArtboards, but I can't seem to find a way to make a selection of them.

var artboards = activeDoc.layers;
var visibleArtboards = [];
for (var i=0; i<artboards.length; i++){
    if(artboards[i].visible){
        visibleArtboards.push(artboards[i]);
    }
}

activedoc.activeLayer can make a selection, but only of 1 single artboard.

If anybody can help me with the missing piece, I'd appreciate it a lot

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can get the layer ID of the artboards and add that to a selection. Using your code, visibleArtboards now is the ID of the artboard layers.

// call the source document
var activeDoc = app.activeDocument;

var artboards = activeDoc.layers;

var visibleArtboards = [];
for (var i=0; i<artboards.length; i++)
{
    if(artboards[i].visible)
    {

      // select ID as we go along
      var layerID = artboards[i].id;
      visibleArtboards.push(layerID);

    }
}

// Loop over the layers again and select all the art boards
for (var i=0; i<visibleArtboards.length; i++)
{
   // add to current selection of layers
   select_by_ID(visibleArtboards[i], true);
}




function select_by_ID(id, add)
{
    if (add == undefined) add = false;
    var desc1 = new ActionDescriptor();
    var ref1 = new ActionReference();
    ref1.putIdentifier(charIDToTypeID('Lyr '), id);
    desc1.putReference(charIDToTypeID('null'), ref1);
    if (add) desc1.putEnumerated(stringIDToTypeID("selectionModifier"), stringIDToTypeID("selectionModifierType"), stringIDToTypeID("addToSelection"));
    executeAction(charIDToTypeID('slct'), desc1, DialogModes.NO);
} // end of selectByID()

It will, however, add the background (if included). I'm sure you can get around that.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda