Skip to main content
Inspiring
November 11, 2017
Answered

Get List of all Photoshop Documents

  • November 11, 2017
  • 3 replies
  • 3573 views

Hi everybody

I was wondering - does anyone know of a way to get a list of all documents that are currently loaded into Photoshop? The list would include the entire title of each document, (including the @17097839.3%, (RGB/8)* that might come after each title, for example.)

Basically, it would be a simple list, with each title on its own new line.

I could have sworn that I had some code like this before, but can't find it.

Is this a simple task?

Thanks in advance

This topic has been closed for replies.
Correct answer SuperMerlin

No. This snippet only ignores the color profile and the color proof view. And I can't change this because of this snippet is only an older jsxbin. I didn't found the jsx.

Have fun


Does this help...

var docs = app.documents;

var docList = new Array(docs.length);

var aDoc = null;

var l = null;

var m = null;

for (var i = 0; i < docs.length; i += 1) {

    aDoc = docs;

    var ref = new ActionReference();

    ref.putIndex(charIDToTypeID("Dcmn"), i + 1);

    var desc = executeActionGet(ref);

    var z = " @" + (Math.round(Number(desc.getDouble(stringIDToTypeID("zoom")) * 1000)) / 10) + "% (" + l = aDoc.layers.length > 1 ? aDoc.activeLayer.name + ", " : "";

    m = aDoc.bitsPerChannel.toString().replace("BitsPerChannelType.", "");

    docList = aDoc.name + z + aDoc.mode.toString().replace("DocumentMode.", "").replace("BITMAP", "Bitmap") + m = m == "ONE" ? ")" : (m == "EIGHT" ? "/8#)" : (m == "SIXTEEN" ? "/16#)" : "/32#)"));

}

alert(docList.join("\n"));

3 replies

Legend
November 12, 2017

You can try to create an analogue of the title of the document window using the following template.

var Title = Copyrighted?"© ":"" + DocName + " @ " + Zoom + "% " +

"(" +

ActiveLayer?(ActiveLayerName + ", "):"" +

ActiveChannelName + "/" + Depth +

UntaggedSpaceIndicator?"#":"" +

NonWorkingSpaceIndicator?"*":"" +

ProofIndicator?("/"+Proof):"") +

PixelHSFIndicator?" [scaled]":"" +

")" +

DirtyDocIndicator?" *":"" +

PendingSaveIndicator?(" - Saving " + pcnt + "%"):""

It remains only to get the required parameters

upd.

was updated

Legend
November 12, 2017

Try this script (jsxbin). Works only on windows.

getdocs.jsxbin - Google Drive

Inspiring
November 12, 2017

r-bin: thanks - the script undocks all documents first ("float all in windows"), then presumably gets all document titles, then re-docks them all again - but the alert that pops up is empty.

SuperMerlin - thanks as well, I tried downloading ExtendedToolScript but the Cloud application window just keeps "waiting..." for hours - seems I can't download that app for whatever reason.

It's all good - it isn't that important a deal, I just seemed to remember having some code that did this a while back, but maybe it's more difficult than it appears

Legend
November 13, 2017

radley+2013  написал(а)

r-bin: thanks - the script undocks all documents first ("float all in windows"), then presumably gets all document titles, then re-docks them all again - but the alert that pops up is empty.

I checked my jsxbin script on CS6 win7 x64. Works great)

SuperMerlin
Inspiring
November 11, 2017

It is a bit of a mixture as that line does some profile checking, here is one way of getting all the information, but you would have to sort out the profile mismatches etc.

Script to be run from ExtendScript Toolkit.

#target photoshop;

$.writeln("Working spaces");

$.writeln("....................");

$.writeln(getWorkingColourSettings().join("\n"));

$.writeln("....................");

$.writeln(getDocInfo().join("\n"));

function getDocInfo(){

var IDs = new Array();

var count = app.documents.length;

for(var a =1; a<count+1;a++){

var ref = new ActionReference();

ref.putIndex( charIDToTypeID( 'Dcmn' ), a);

var desc = executeActionGet(ref);

var Zoom = Number(desc.getDouble(stringIDToTypeID('zoom'))*100).toFixed(0);

var Mode = typeIDToStringID(desc.getEnumerationValue( stringIDToTypeID( 'mode' )));

var Depth = desc.getDouble(stringIDToTypeID('depth'));

if(desc.hasKey (stringIDToTypeID( 'profile' ))){

var Profile = desc.getString(stringIDToTypeID( 'profile' ));

}else{

    var Profile = "#";

    }

var ID = desc.getInteger (stringIDToTypeID('documentID'));

var Title = desc.getString(stringIDToTypeID('title'));

IDs.push([[ID],[Title],[Zoom],[Mode],[Depth],[Profile]]);

    }

return IDs;

};

function getWorkingColourSettings(){

var ws = new Array();

var desc = new ActionDescriptor();

var ref = new ActionReference();

ref.putProperty( charIDToTypeID('Prpr'), stringIDToTypeID('colorSettings') );

ref.putEnumerated( charIDToTypeID('capp'), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );

var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('colorSettings'));

ws.push(desc.getString( stringIDToTypeID('workingRGB')));

ws.push(desc.getString( stringIDToTypeID('workingCMYK')));

ws.push(desc.getString( stringIDToTypeID('workingGray')));

return ws;

};

pixxxelschubser
Community Expert
Community Expert
November 11, 2017

Not bad.

But IMO boo radley 2013​ means something like this:

Inspiring
November 11, 2017

pixxxel schubser: yes, that's it !

Do you happen to have a script for that?