Copy link to clipboard
Copied
There is a new feature in Photoshop CC 2015 to create the multiple artboards in the same document.
I want to get the properties of artboards like x, y, height etc. Is it possible to fetch the artboard details from the script?
Thanks.
Have you bothered to do a Forum search yet?
https://forums.adobe.com/search.jspa?q=artboard&place=%2Fplaces%2F1383833&depth=ALL
Copy link to clipboard
Copied
Have you bothered to do a Forum search yet?
https://forums.adobe.com/search.jspa?q=artboard&place=%2Fplaces%2F1383833&depth=ALL
Copy link to clipboard
Copied
Thank you for pointing me in right direction.
Copy link to clipboard
Copied
Also maybe this helps:
// 2015, use it at your own risk;
#target "photoshop-90.032"
if (app.documents.length > 0) {
var theArtboards = getArtboardStuff();
alert (theArtboards.join("\n"));
};
////////////////////////////////////
function getArtboardStuff () {
var originalRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
// the file;
var myDocument = app.activeDocument;
// get number of layers;
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var applicationDesc = executeActionGet(ref);
var theNumber = applicationDesc.getInteger(stringIDToTypeID("numberOfLayers"));
// process the layers;
var theLayers = new Array;
for (var m = 0; m <= theNumber; m++) {
try {
var ref = new ActionReference();
ref.putIndex( charIDToTypeID( "Lyr " ), m);
var layerDesc = executeActionGet(ref);
// if artboard;
if (layerDesc.getBoolean(stringIDToTypeID("artboardEnabled")) == true) {
var artBoardRect = layerDesc.getObjectValue(stringIDToTypeID("artboard")).getObjectValue(stringIDToTypeID("artboardRect"));
var theName = layerDesc.getString(stringIDToTypeID('name'));
var theID = layerDesc.getInteger(stringIDToTypeID('layerID'));
theLayers.push([theName, theID, [artBoardRect.getUnitDoubleValue(stringIDToTypeID("left")), artBoardRect.getUnitDoubleValue(stringIDToTypeID("top")), artBoardRect.getUnitDoubleValue(stringIDToTypeID("right")), artBoardRect.getUnitDoubleValue(stringIDToTypeID("bottom"))]])
};
}
catch (e) {};
};
////////////////////////////////////
app.preferences.rulerUnits = originalRulerUnits;
return theLayers
};
Copy link to clipboard
Copied
I've been testing things with artboard. I am creating a LayerSet outside the Artboard, but when I create a line (using Action Manager code) after selecting the LayerSet. LayerSet automatically move to the Artboard.
Is there any way to avoid this case? I don't want LayerSet to move to the ArtBoard.
Thanks for any help
Copy link to clipboard
Copied
Is there any way to turn off the "autoNestEnabled" property of artboard?
Copy link to clipboard
Copied
Does this work?
// =======================================================
var ideditArtboardEvent = stringIDToTypeID( "editArtboardEvent" );
var desc3 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref2 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref2.putEnumerated( idLyr, idOrdn, idTrgt );
desc3.putReference( idnull, ref2 );
var idautoNestEnabled = stringIDToTypeID( "autoNestEnabled" );
desc3.putBoolean( idautoNestEnabled, false );
executeAction( ideditArtboardEvent, desc3, DialogModes.NO );
Copy link to clipboard
Copied
Thanks a ton. It's working.