Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

78
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda