4 Replies Latest reply on Feb 2, 2011 8:06 AM by JJMack

    Need to export root groups to jpg's

    MortenSJ00 Level 1

      Hi there

       

      I'm a webdesigner and a lot of time goes with saving screenshots of the webpage. Lets say i'm building a webpage in Photoshop.

       

      I got 6 different pages grouped in 6 folders in my Layers. I need to find a way to export all 6 folders with a script so i dont have to do the same thing 6 times.

       

      I did found a script here, but it exports ALL folders. I like to group my things so i also have folders in my 6 root folders. So i basicly need to find a way to export my 6 root folders without exporting all the folders beneath.

       

      Hope you guys can help me!

       

      Morten

        • 1. Re: Need to export root groups to jpg's
          MortenSJ00 Level 1

          Okay.

           

          I found this script and it works perfectly

           

          #target photoshop
          function main(){
          if(!documents.length) return;
          var doc = activeDocument;
          var oldPath = activeDocument.path;
          for(var a=0;a<doc.layerSets.length;a++){
          activeDocument.activeLayer = activeDocument.layers.getByName(doc.layerSets[a].name);
          dupLayers();
          activeDocument.mergeVisibleLayers();
          var saveFile= File(oldPath +"/"+doc.layerSets[a].name +".jpg");
          SaveJPG(saveFile);
          app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
              }
          }
          main();
          function dupLayers() { 
              var desc143 = new ActionDescriptor();
                  var ref73 = new ActionReference();
                  ref73.putClass( charIDToTypeID('Dcmn') );
              desc143.putReference( charIDToTypeID('null'), ref73 );
              desc143.putString( charIDToTypeID('Nm  '), activeDocument.activeLayer.name );
                  var ref74 = new ActionReference();
                  ref74.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
              desc143.putReference( charIDToTypeID('Usng'), ref74 );
              executeAction( charIDToTypeID('Mk  '), desc143, DialogModes.NO );
          };
          function SaveJPG(saveFile){
          var jpgOpts = new ExportOptionsSaveForWeb; 
          jpgOpts.format = SaveDocumentType.JPEG
          jpgOpts.quality = 100;
          activeDocument.exportDocument(new File(saveFile),ExportType.SAVEFORWEB,jpgOpts); 
          }
          

           

          The thing is that i would like to control the output and some other things

           

          Is it possible to get a window where i can change output path and change the quality and even the format. Ex. png?

          • 2. Re: Need to export root groups to jpg's
            JJMack Most Valuable Participant

            It is possible to program dialogs like that into Photoshop scripts. Photoshop scripting is very powerful it is also programming which requires designing and scripting language skills.  Three languages are supported but only javascript is support in both the Mac and Windows enviroments.

            • 3. Re: Need to export root groups to jpg's
              MortenSJ00 Level 1

              Thanks alot JJMack

               

              I'm no scripter so this is way out of my league, but if someone would help me get it done i would very much appreaciate it. I can't offer anything at all, so i don't expect people to do actually do it

              • 4. Re: Need to export root groups to jpg's
                JJMack Most Valuable Participant

                MortenSJ00 wrote:

                if someone would help me get it done i would very much appreaciate it,  I can't offer anything at all

                To me this statement seem to be a contradiction. Nonsense....  There are many scripts in this forum with dialogs its a good time to learn some scripting. You seem to have a reason to want too.