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

Photoshop 2015 artboards in scripting

Enthusiast ,
Jun 11, 2015 Jun 11, 2015

Copy link to clipboard

Copied

Anyone seen info / had a chance to test how artboards will workout in scripting? I guess data model could be pretty similar, i.e. an artboard is just new kind of group. The primary effect is in rendering / display, but probably most scripts will at least need an adjustment in logic (i.e. do you run through all art boards as one/separate or just the "active one".

Sneak Peek: Artboards in Photoshop CC - YouTube

TOPICS
Actions and scripting

Views

7.3K

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
Adobe
Adobe Employee ,
Feb 04, 2016 Feb 04, 2016

Copy link to clipboard

Copied

I can't vouch for the provenance of that code, so I'm not sure how/if it's supposed to work   Is there a specific thing you're trying to do with Artboards that you're trying to solve in ExtendScript?    My sample above includes all the artboard-specific scripting commands, otherwise you would handle Artboards as you would layer groups (for moving, selecting, naming, etc.)  For more sample code, you might take a look at the sample .jsx inside the "networkclientprototype" source in the latest Photoshop SDK (a mac app that deals in generator and network connections, but it demonstrates Artboard property-getting which might be useful).  And there's also a couple of Artboard export scripts, ArtBoards To Files.jsx/ArtBoards To PDF.jsx, inside the Photoshop Presets/Scripts folder. (code for Photoshop's File->Export items for Artboards).  The script listener plugin can also help to find Javascript by recording actions in Photoshop.

Converting Comps to Artboards is kind of a large problem, but one way to approach it is to repeatedly apply the comps and duplicate all the original layers into new groups and convert those into Artboards (see MakeArtboardFromLayerGroup/artboardFromLayerGroupEvent in the code above to convert groups into Artboards), and then move the new Artboard groups to an appropriate spot (using a move event, or something like it). To save space and promote easier re-use it might make sense to convert (some) of the layers into smart objects (using "newPlacedLayer" for which you can see some usage in some of the Presets/Scripts included w/the app, e.g. Merge to HDR)

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
Enthusiast ,
Feb 05, 2016 Feb 05, 2016

Copy link to clipboard

Copied

Well, the SDK is still due an update just to get the docs straight and expose the artboard-stuff "as proper properties and methods.

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
Adobe Employee ,
Feb 05, 2016 Feb 05, 2016

Copy link to clipboard

Copied

True enough, the SDK/Scripting plugin should be changed to make them accessible through dot notation.  But that shouldn't affect the actual underlying implementation, or what you can do vis a vis scripting Artboards (it just makes the code prettier).  I was more wondering if there's anything beyond that, that's broken/missing/impossible to do right now, or there's a question of how to script it.  Maybe I could help with that in the mean time, since I don't control the SDK or the SDK release schedule personally. I can communicate it to the proper people, I just can't promise when it will happen.

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
New Here ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

thank you, your script is very usefull!

but how to set rulers origin in document?

your script is getting it, but I need to set it.

pls 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
New Here ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

BTW, sorry, but your code in TargetRulerOrigin() is slightly incorrect:

  return {x:rulerOrigin.getInteger(propRulerOriginH) / 65536,

  y:rulerOrigin.getInteger(propRulerOriginH) / 65536};

this fragment returns the SAME value for X and Y :))))

and replacing propRulerOriginH with propRulerOriginV doesn't works for some reason - ExtendScript Toolkit stops with error.


this function works for me only after I replaced it with this code:

function TargetRulerOrigin() {

        var ref = new ActionReference();

        ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );

        var desc = executeActionGet(ref);

        return {x:desc.getInteger(stringIDToTypeID('rulerOriginH')) >> 16,

                     y:desc.getInteger(stringIDToTypeID('rulerOriginV')) >> 16};

}

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
Adobe Employee ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

Yes, that is correct, thanks.  You can only have one property per get I think, so you either have to call two "set" actions with different properties/references, or get all the document properties, as in your version.  Here's some additions to set the ruler origin (again, caveats.. no extensive testing.. etc.)

var actionSet = charIDToTypeID( "setd" );

var keyTo = charIDToTypeID( 'T   ' );

function SetTargetRulerOrigin(inX, inY) {

  var theRef = new ActionReference();

  theRef.putProperty(classProperty, propRulerOriginH);

  theRef.putEnumerated(classDocument, typeOrdinal, enumTarget);

  var setDescriptor = new ActionDescriptor();

  setDescriptor.putReference(idnull,theRef);

  setDescriptor.putInteger( keyTo, inX * 65536 );

  executeAction( actionSet, setDescriptor, DialogModes.NO );

  theRef = new ActionReference();

  theRef.putProperty(classProperty, propRulerOriginV);

  theRef.putEnumerated(classDocument, typeOrdinal, enumTarget);

  setDescriptor = new ActionDescriptor();

  setDescriptor.putReference(idnull,theRef);

  setDescriptor.putInteger( keyTo,  inY * 65536 );

  executeAction( actionSet, setDescriptor, DialogModes.NO );

  }

//Ruler set/get test.

var oldRulerOrigin = TargetRulerOrigin();

SetTargetRulerOrigin(100,100);

var newRulerOrigin = TargetRulerOrigin();

alert("Artboards\n" +

  "Changed Ruler Origin from: " + PointToString(oldRulerOrigin) + " to: " + PointToString(newRulerOrigin)

);

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
Adobe Employee ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

And here's another corrected version of TargetRulerOrigin()

function TargetRulerOrigin() {

  var theRef = new ActionReference();

  theRef.putProperty(classProperty, propRulerOriginH);

  theRef.putEnumerated(classDocument, typeOrdinal, enumTarget);

  var getDescriptor = new ActionDescriptor();

  getDescriptor.putReference(idnull,theRef);

  var rulerOriginX = executeAction( actionGet, getDescriptor, DialogModes.NO );

  theRef = new ActionReference();

  theRef.putProperty(classProperty, propRulerOriginV);

  theRef.putEnumerated(classDocument, typeOrdinal, enumTarget);

  getDescriptor = new ActionDescriptor();

  getDescriptor.putReference(idnull,theRef);

  var rulerOriginY = executeAction( actionGet, getDescriptor, DialogModes.NO );

  return {x:rulerOriginX.getInteger(propRulerOriginH) / 65536,

           y:rulerOriginY.getInteger(propRulerOriginV) / 65536};

  }

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 ,
Nov 30, 2018 Nov 30, 2018

Copy link to clipboard

Copied

LATEST

Tim, has this been documented yet in any SDK?

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
New Here ,
Feb 10, 2016 Feb 10, 2016

Copy link to clipboard

Copied

thank you very much for your help!

your code doing exactly what it should!

thanks again! :)))

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
Explorer ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

I'm trying to read the current value of "autoExpandEnabled". Anyone knows how to find it?

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 Beginner ,
Jun 17, 2015 Jun 17, 2015

Copy link to clipboard

Copied

I have been trying to create a script all night that will turn my existing PSDs into Artboards for one document. Has anyone had any luck on this?

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