19 Replies Latest reply on Nov 13, 2017 1:18 AM by r-bin

    Get List of all Photoshop Documents

    boo radley 2013 Level 3

      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 @33.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

        • 1. Re: Get List of all Photoshop Documents
          SuperMerlin Level 5

          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;
          };
          
          
          
          1 person found this helpful
          • 2. Re: Get List of all Photoshop Documents
            pixxxel schubser MVP & Adobe Community Professional

            Not bad.

             

            But IMO boo radley 2013 means something like this:

            documents_listOfOpenedDocuments.png

            • 3. Re: Get List of all Photoshop Documents
              boo radley 2013 Level 3

              pixxxel schubser: yes, that's it !

               

               

              Do you happen to have a script for that?

              • 4. Re: Get List of all Photoshop Documents
                pixxxel schubser MVP & Adobe Community Professional

                I think.

                At the end of last year I played with a similar requirement. It was only a study … …somewhere on my computer.

                • 5. Re: Get List of all Photoshop Documents
                  r-bin Level 5

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

                   

                  getdocs.jsxbin - Google Drive

                  • 6. Re: Get List of all Photoshop Documents
                    boo radley 2013 Level 3

                    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

                    • 7. Re: Get List of all Photoshop Documents
                      SuperMerlin Level 5

                      That script writes an exe file to get the windows titles, but it is 32bit so does not work on 64bit systems.

                      TASKLIST /v /FI "imagename eq photoshop.exe"

                      Will give you the information for the active document.

                      • 8. Re: Get List of all Photoshop Documents
                        pixxxel schubser MVP & Adobe Community Professional

                        Didn't found the jsx yet. I only found the jsxbin. But should also works

                        #target photoshop
                        // documents_listOfOpenedDocumentsModeBitdepth_jsxbin.jsx
                        eval("""@JSXBIN@ES@2.0@MyBbyBn0AGJAnASzEjEjPjDjTByBXzJjEjPjDjVjNjFjOjUjTCfjzDjBjQjQDfnft\
                        JBnASzHjEjPjDiMjJjTjUEyBEjzFiBjSjSjBjZFfRBXzGjMjFjOjHjUjIGfVBfyBftnftJCnASzEjBi\
                        EjPjDHyBnbftJDnASzBjMIyBnbftJEnASzBjNJyBnbftaGbHn0AHJHnASHyBQzAKfVBfyBjzBjJLfnf\
                        fJInASzDjSjFjGMyBEjzPiBjDjUjJjPjOiSjFjGjFjSjFjOjDjFNfntnftJJnAEXzIjQjVjUiJjOjEj\
                        FjYOfVMfyBRCEjzOjDjIjBjSiJiEiUjPiUjZjQjFiJiEPfRBFeEiEjDjNjOffCzBhLQjLfnndBffJKn\
                        ASzEjEjFjTjDRyBEjzQjFjYjFjDjVjUjFiBjDjUjJjPjOiHjFjUSfRBVMfyBffnftJLnASzBjaTyBCQ\
                        CQCQnCzBhPUEXzFjSjPjVjOjEVfjzEiNjBjUjIWfRBEjzGiOjVjNjCjFjSXfRBCzBhKYEXzJjHjFjUi\
                        EjPjVjCjMjFZfVRfyBRBEjzQjTjUjSjJjOjHiJiEiUjPiUjZjQjFiJiEgafRBFeEjajPjPjNffffnnd\
                        2nIDffffnndKeChAiAnnneDhFhAhISIyBdCzBhegbXGfXzGjMjBjZjFjSjTgcfVHfyBnndBCQXzEjOj\
                        BjNjFgdfXzLjBjDjUjJjWjFiMjBjZjFjSgefVHfyBnneChMhAFeAnffnnnftJMnASJyBEXzHjSjFjQj\
                        MjBjDjFgffEXzIjUjPiTjUjSjJjOjHhAfXzOjCjJjUjTiQjFjSiDjIjBjOjOjFjMhBfVHfyBnfRCFeT\
                        iCjJjUjTiQjFjSiDjIjBjOjOjFjMiUjZjQjFhOFeAffnffJNnABQKfVEfyBjLfCQCQCQXgdfVHfyBVT\
                        fyBnnEXgffEXgffEXhAfXzEjNjPjEjFhCfVHfyBnfRCFeNiEjPjDjVjNjFjOjUiNjPjEjFhOFeAffRC\
                        FeGiCiJiUiNiBiQFeGiCjJjUjNjBjQffnnSJyBdCzChdhdhDVJfyBnneDiPiOiFFeBhJdChDVJfyBnn\
                        eFiFiJiHiIiUFeEhPhYhDhJdChDVJfyBnneHiTiJiYiUiFiFiOFeFhPhRhWhDhJFeFhPhThShDhJnff\
                        nnnfAjLfAXGfVBfyBByBzBhchEAIJ4E0AiAB40BiAM4F0AiAR4G0AiAE4B0AiAI4D0AiAH4C0AiAT4H\
                        0AiAAIAKByB""");
                        alert(docList.join("\n"));
                        

                         

                        Give it a try and have fun

                         

                        • 9. Re: Get List of all Photoshop Documents
                          r-bin Level 5

                          SuperMerlin  написал(а)

                           

                          That script writes an exe file to get the windows titles, but it is 32bit so does not work on 64bit systems.

                          TASKLIST /v /FI "imagename eq photoshop.exe"

                          Will give you the information for the active document.

                           

                          Yes, you got me through. )
                          I use the utility "cmdow.exe" to get a list of all the windows. I filter the list on the line "Phototoshop" and determine that this is a document by the " @ " in the header. It's strange that it does not work on x64. Tomorrow can be checked. Also, an error was detected when using CC2018. The script can not correctly determine whether the photoshop is in tabs or float mode. Something changed in preferences.

                          P.S. For some reason, I will not yet lay out the source code of the script.

                          P.S.S. English through translator

                          • 10. Re: Get List of all Photoshop Documents
                            r-bin Level 5

                            https://forums.adobe.com/people/pixxxel+schubser  написал(а)

                             

                            Didn't found the jsx yet. I only found the jsxbin. But should also works

                            ......

                            Give it a try and have fun

                             

                            This script is lying.

                             

                            Untitled-3.png

                             

                            • 11. Re: Get List of all Photoshop Documents
                              pixxxel schubser MVP & Adobe Community Professional

                               

                               

                              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

                               

                              • 12. Re: Get List of all Photoshop Documents
                                boo radley 2013 Level 3

                                it says "Syntax Error" on Line 3

                                 

                                 

                                Didn't found the jsx yet. I only found the jsxbin. But should also works

                                 

                                 

                                1. #target photoshop 
                                2. // documents_listOfOpenedDocumentsModeBitdepth_jsxbin.jsx 
                                3. eval("""@JSXBIN@ES@2.0@MyBbyBn0AGJAnASzEjEjPjDjTByBXzJjEjPjDjVjNjFjOjUjTCfjzDjBjQjQDfnft\ 
                                4. JBnASzHjEjPjDiMjJjTjUEyBEjzFiBjSjSjBjZFfRBXzGjMjFjOjHjUjIGfVBfyBftnftJCnASzEjBi\ 
                                5. EjPjDHyBnbftJDnASzBjMIyBnbftJEnASzBjNJyBnbftaGbHn0AHJHnASHyBQzAKfVBfyBjzBjJLfnf\ 
                                6. fJInASzDjSjFjGMyBEjzPiBjDjUjJjPjOiSjFjGjFjSjFjOjDjFNfntnftJJnAEXzIjQjVjUiJjOjEj\ 
                                7. FjYOfVMfyBRCEjzOjDjIjBjSiJiEiUjPiUjZjQjFiJiEPfRBFeEiEjDjNjOffCzBhLQjLfnndBffJKn\ 
                                8. ASzEjEjFjTjDRyBEjzQjFjYjFjDjVjUjFiBjDjUjJjPjOiHjFjUSfRBVMfyBffnftJLnASzBjaTyBCQ\ 
                                9. CQCQnCzBhPUEXzFjSjPjVjOjEVfjzEiNjBjUjIWfRBEjzGiOjVjNjCjFjSXfRBCzBhKYEXzJjHjFjUi\ 
                                10. EjPjVjCjMjFZfVRfyBRBEjzQjTjUjSjJjOjHiJiEiUjPiUjZjQjFiJiEgafRBFeEjajPjPjNffffnnd\ 
                                11. 2nIDffffnndKeChAiAnnneDhFhAhISIyBdCzBhegbXGfXzGjMjBjZjFjSjTgcfVHfyBnndBCQXzEjOj\ 
                                12. BjNjFgdfXzLjBjDjUjJjWjFiMjBjZjFjSgefVHfyBnneChMhAFeAnffnnnftJMnASJyBEXzHjSjFjQj\ 
                                13. MjBjDjFgffEXzIjUjPiTjUjSjJjOjHhAfXzOjCjJjUjTiQjFjSiDjIjBjOjOjFjMhBfVHfyBnfRCFeT\ 
                                14. iCjJjUjTiQjFjSiDjIjBjOjOjFjMiUjZjQjFhOFeAffnffJNnABQKfVEfyBjLfCQCQCQXgdfVHfyBVT\ 
                                15. fyBnnEXgffEXgffEXhAfXzEjNjPjEjFhCfVHfyBnfRCFeNiEjPjDjVjNjFjOjUiNjPjEjFhOFeAffRC\ 
                                16. FeGiCiJiUiNiBiQFeGiCjJjUjNjBjQffnnSJyBdCzChdhdhDVJfyBnneDiPiOiFFeBhJdChDVJfyBnn\ 
                                17. eFiFiJiHiIiUFeEhPhYhDhJdChDVJfyBnneHiTiJiYiUiFiFiOFeFhPhRhWhDhJFeFhPhThShDhJnff\ 
                                18. nnnfAjLfAXGfVBfyBByBzBhchEAIJ4E0AiAB40BiAM4F0AiAR4G0AiAE4B0AiAI4D0AiAH4C0AiAT4H\ 
                                19. 0AiAAIAKByB"""); 
                                20. alert(docList.join("\n")); 

                                 

                                Give it a try and have fun

                                • 13. Re: Get List of all Photoshop Documents
                                  pixxxel schubser MVP & Adobe Community Professional

                                  Be sure that your did not copy any additional spaces before or between or after the visible code.

                                  • 14. Re: Get List of all Photoshop Documents
                                    SuperMerlin Level 5

                                    Getting closer but no profile checking.

                                    • 15. Re: Get List of all Photoshop Documents
                                      SuperMerlin Level 5

                                      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[i];
                                          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[i] = 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")); 
                                      
                                      
                                      2 people found this helpful
                                      • 16. Re: Get List of all Photoshop Documents
                                        pixxxel schubser MVP & Adobe Community Professional

                                        SuperMerlin  schrieb

                                         

                                        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[i];     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[i] = 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"));  

                                         

                                        SuperMerlin, you seems to be a very very bad boy.

                                         

                                         

                                        This is my kind of coding and my variables also. This is my binary decoded - right?

                                         

                                        • 17. Re: Get List of all Photoshop Documents
                                          r-bin Level 5

                                          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

                                          • 18. Re: Get List of all Photoshop Documents
                                            boo radley 2013 Level 3

                                            this works!

                                            Thanks, SuperMerlin!!

                                             

                                            And thanks to pixxel schubser and r-bin as well

                                             

                                            this will be a very useful script to switch documents in Photoshop.

                                             

                                            Right now I hate clicking on the tabs to change documents. There should be a "list", or a document panel or something which would make it much faster to find the document you want to switch to.

                                             

                                            This script will be the first step in designing a listview of all documents. Kind of like clicking on the "Window" menu in Photoshop, then scrolling down to the document you want - but that's a hassle too. There needs to be a panel or something with a list of all documents that is visible at all times, sort of like the layers panel.

                                            • 19. Re: Get List of all Photoshop Documents
                                              r-bin Level 5

                                              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)

                                              xxxx.png