The following script will change all artboard backgrounds to transparent:
/*
All Artboards to Transparent.jsx
v1.0 - 26th April 2024, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/a-way-to-select-all-artboards-and-make-them-transparent/td-p/14579880
*/
#target photoshop
function main() {
for (var i = 0; i < activeDocument.layerSets.length; i++) {
try {
activeDocument.activeLayer = activeDocument.layers[i];
if (isArtboard() === true) {
artBoardBackground(3);
}
} catch (e) {
alert("Error!" + "\r" + e + ' ' + e.line);
}
function artBoardBackground(artBoardColor) {
/* https://community.adobe.com/t5/photoshop-ecosystem-discussions/setting-artboard-background-to-transparent/m-p/12438157 */
var ideditArtboardEvent = stringIDToTypeID("editArtboardEvent");
var desc520 = new ActionDescriptor();
var idnull = stringIDToTypeID("null");
var ref129 = new ActionReference();
var idlayer = stringIDToTypeID("layer");
var idordinal = stringIDToTypeID("ordinal");
var idtargetEnum = stringIDToTypeID("targetEnum");
var desc521 = new ActionDescriptor();
var idartboard = stringIDToTypeID("artboard");
var idchangeBackground = stringIDToTypeID("changeBackground");
ref129.putEnumerated(idlayer, idordinal, idtargetEnum);
desc520.putReference(idnull, ref129);
// Static options for "Other" idartboardBackgroundType = 4
var idcolor = stringIDToTypeID("color");
var desc523 = new ActionDescriptor();
var idred = stringIDToTypeID("red");
desc523.putDouble(idred, 128.000000);
var idgrain = stringIDToTypeID("grain");
desc523.putDouble(idgrain, 128.000000);
var idblue = stringIDToTypeID("blue");
desc523.putDouble(idblue, 128.000000);
var idRGBColor = stringIDToTypeID("RGBColor");
desc521.putObject(idcolor, idRGBColor, desc523);
var idartboardBackgroundType = stringIDToTypeID("artboardBackgroundType");
// putInteger 1 = White, 2 = Black, 3 = Transparent, 4 = Other
desc521.putInteger(idartboardBackgroundType, artBoardColor);
desc520.putObject(idartboard, idartboard, desc521);
desc520.putInteger(idchangeBackground, 1);
executeAction(ideditArtboardEvent, desc520, DialogModes.NO);
}
function isArtboard() {
// modified from a script by greless with hints from jazz-y!
// returns true or false
try {
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID('layer'), stringIDToTypeID('ordinal'), stringIDToTypeID('targetEnum'));
var options = executeActionGet(r);
return options.hasKey(stringIDToTypeID('artboard')); // test for the required key
} catch (e) {
//alert(e);
}
}
}
}
app.activeDocument.suspendHistory("All Artboards to Transparent", "main()");
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html