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

How to get document desc (throw AAM) by index?

Mentor ,
Oct 03, 2019 Oct 03, 2019

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?

TOPICS
Actions and scripting
1.1K
Translate
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
Mentor ,
Oct 03, 2019 Oct 03, 2019
LATEST

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

Translate
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