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

70
Views
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 answers
Answer question

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 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!