Copy link to clipboard
Copied
A lot of documents are open in Photoshop, I need to go through all of them to get a certain property of the document (preferably without making each active, and not using the DOM (for example, to get an ID or name)). I am trying to use code like:
var r = new ActionReference ()
var d = new ActionDescriptor ()
r.putIndex (stringIDToTypeID("document"), 1) // 1 - planned to iterate over the index in the loop
d = executeActionGet (r)
But it only works if the documents are open in separate windows. If they are opened as tabs - it does not work. What am I doing wrong and is there any way to solve this problem?
Copy link to clipboard
Copied
Very strange situation.
I managed to find out that in the latest version of Photoshop (when displaying documents as tabs), this code does not work:
var r1 = new ActionReference ();
var d1 = new ActionDescriptor ();
r1.putIndex (stringIDToTypeID("document"), 1);
d1 = executeActionGet (r1)
but it (for some reason) starts to work if i try to get a specific property of the document, for example:
var r1 = new ActionReference ();
var d1 = new ActionDescriptor ();
r1.putProperty (stringIDToTypeID("property"), stringIDToTypeID("title"));
r1.putIndex (stringIDToTypeID("document"), 1);
d1 = executeActionGet (r1)
it seems to me like some kind of bug: I can’t get the Reference of the whole document, but I can consistently get ALL of its properties (if I specify them in advance through putProperty).
anyway my problem is solved. but maybe it’s useful to someone else