• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to get artboard properties in photoshop CC 2015?

Participant ,
Aug 05, 2015 Aug 05, 2015

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.

TOPICS
Actions and scripting

Views

1.5K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 05, 2015 Aug 05, 2015

Votes

Translate

Translate
Adobe
Community Expert ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 05, 2015 Aug 05, 2015

Copy link to clipboard

Copied

Thank you for pointing me in right direction.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 05, 2015 Aug 05, 2015

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

};

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 07, 2015 Aug 07, 2015

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 07, 2015 Aug 07, 2015

Copy link to clipboard

Copied

Is there any way to turn off the "autoNestEnabled" property of artboard?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 08, 2015 Aug 08, 2015

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 );

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Aug 08, 2015 Aug 08, 2015

Copy link to clipboard

Copied

LATEST

Thanks a ton. It's working.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines