7 Replies Latest reply on May 22, 2015 9:10 AM by essejesse

    save for web options

    essejesse Level 1

      I'm having an issue specifying all the options for saving a JPG via save for web. I've looked at the PS javascript reference PDF, and found 18 different options to specify, but here are ones I just can't find.

       

      Preview (I want to select Internet Standard)

      Metadata (I want to select None)

      and in the image size section, I want to set Quality to Bicubic.

       

      I've looked at the Object Model Viewer, and the PDF I mentioned above, but they are just mirrors of one another.

       

      I'm hoping it's something I'm just missing, here's where I've gotten with setting my options so far:

       

      //save for web options

      sfwJpgOpts = new ExportOptionsSaveForWeb ()

      sfwJpgOpts.blur = 0

      sfwJpgOpts.includeProfile = false

      sfwJpgOpts.format = SaveDocumentType.JPEG

      sfwJpgOpts.quality = 85

      sfwJpgOpts.formatOptions = FormatOptionsType.PROGRESSIVE

       

       

      Any help is greatly appreciated!

        • 1. Re: save for web options
          essejesse Level 1

          Another option would be to somehow specify a preset that I have created. I just don't know how to access that either

          • 2. Re: save for web options
            c.pfaffenbichler Level 9

            Have you tried recording Action Manager code with ScriptingListener.plugin?

            • 3. Re: save for web options
              essejesse Level 1

              I've never been good at using that thing, so no. I suppose I should give it a try :\

               

              I've seen that people clean up what it outputs too, and once they have it almost seems to make sense to me, but then again, I could say that about most of any script I didn't write myself.

              • 4. Re: save for web options
                c.pfaffenbichler Level 9
                I suppose I should give it a try

                You should.

                If you will need to change values later on enter values you are likely to recognise in the code and then wrap it up in a function and replace them with arguments the function takes.

                • 5. Re: save for web options
                  essejesse Level 1

                  I'm in the process of reinstalling the plugin (new version of PS since last I tried).

                   

                  Do you think I'll be able to separate the save location easily after doing the script listener? I'm going to specify in another part of the script that the file name be prepended and want to create a unique folder based on the original file name, within an existing file structure, but not the one the file is currently residing in.

                   

                  All that I can do, but I'm wondering if the portion that I use the script listener plugin for will supersede it, and be unrecognizable. Feel free to ignore this if once I actually do it, you think it will become apparent.

                  • 6. Re: save for web options
                    c.pfaffenbichler Level 9

                    I think you’ll be able to locate those parts easily.

                    Here it would be the lines

                            desc4.putPath( idIn, new File( "/Users/xxx/Desktop" ) );
                    

                    for the path and

                            desc4.putString( idovFN, """filenam.jpg""" );
                    

                    for the name.

                     

                    // =======================================================
                    var idExpr = charIDToTypeID( "Expr" );
                        var desc3 = new ActionDescriptor();
                        var idUsng = charIDToTypeID( "Usng" );
                            var desc4 = new ActionDescriptor();
                            var idOp = charIDToTypeID( "Op  " );
                            var idSWOp = charIDToTypeID( "SWOp" );
                            var idOpSa = charIDToTypeID( "OpSa" );
                            desc4.putEnumerated( idOp, idSWOp, idOpSa );
                            var idDIDr = charIDToTypeID( "DIDr" );
                            desc4.putBoolean( idDIDr, true );
                            var idIn = charIDToTypeID( "In  " );
                            desc4.putPath( idIn, new File( "/Users/xxx/Desktop" ) );
                            var idovFN = charIDToTypeID( "ovFN" );
                            desc4.putString( idovFN, """filenam.jpg""" );
                            var idFmt = charIDToTypeID( "Fmt " );
                            var idIRFm = charIDToTypeID( "IRFm" );
                            var idJPEG = charIDToTypeID( "JPEG" );
                            desc4.putEnumerated( idFmt, idIRFm, idJPEG );
                            var idIntr = charIDToTypeID( "Intr" );
                            desc4.putBoolean( idIntr, false );
                            var idQlty = charIDToTypeID( "Qlty" );
                            desc4.putInteger( idQlty, 60 );
                            var idQChS = charIDToTypeID( "QChS" );
                            desc4.putInteger( idQChS, 0 );
                            var idQCUI = charIDToTypeID( "QCUI" );
                            desc4.putInteger( idQCUI, 0 );
                            var idQChT = charIDToTypeID( "QChT" );
                            desc4.putBoolean( idQChT, false );
                            var idQChV = charIDToTypeID( "QChV" );
                            desc4.putBoolean( idQChV, false );
                            var idOptm = charIDToTypeID( "Optm" );
                            desc4.putBoolean( idOptm, true );
                            var idPass = charIDToTypeID( "Pass" );
                            desc4.putInteger( idPass, 1 );
                            var idblur = charIDToTypeID( "blur" );
                            desc4.putDouble( idblur, 0.000000 );
                            var idEICC = charIDToTypeID( "EICC" );
                            desc4.putBoolean( idEICC, false );
                            var idMtt = charIDToTypeID( "Mtt " );
                            desc4.putBoolean( idMtt, true );
                            var idMttR = charIDToTypeID( "MttR" );
                            desc4.putInteger( idMttR, 255 );
                            var idMttG = charIDToTypeID( "MttG" );
                            desc4.putInteger( idMttG, 255 );
                            var idMttB = charIDToTypeID( "MttB" );
                            desc4.putInteger( idMttB, 255 );
                            var idHScl = charIDToTypeID( "HScl" );
                            var idPrc = charIDToTypeID( "#Prc" );
                            desc4.putUnitDouble( idHScl, idPrc, 50.000000 );
                            var idVScl = charIDToTypeID( "VScl" );
                            var idPrc = charIDToTypeID( "#Prc" );
                            desc4.putUnitDouble( idVScl, idPrc, 50.000000 );
                            var idSHTM = charIDToTypeID( "SHTM" );
                            desc4.putBoolean( idSHTM, false );
                            var idSImg = charIDToTypeID( "SImg" );
                            desc4.putBoolean( idSImg, true );
                            var idSWsl = charIDToTypeID( "SWsl" );
                            var idSTsl = charIDToTypeID( "STsl" );
                            var idSLAl = charIDToTypeID( "SLAl" );
                            desc4.putEnumerated( idSWsl, idSTsl, idSLAl );
                            var idSWch = charIDToTypeID( "SWch" );
                            var idSTch = charIDToTypeID( "STch" );
                            var idCHsR = charIDToTypeID( "CHsR" );
                            desc4.putEnumerated( idSWch, idSTch, idCHsR );
                            var idSWmd = charIDToTypeID( "SWmd" );
                            var idSTmd = charIDToTypeID( "STmd" );
                            var idMDCC = charIDToTypeID( "MDCC" );
                            desc4.putEnumerated( idSWmd, idSTmd, idMDCC );
                            var idohXH = charIDToTypeID( "ohXH" );
                            desc4.putBoolean( idohXH, false );
                            var idohIC = charIDToTypeID( "ohIC" );
                            desc4.putBoolean( idohIC, true );
                            var idohAA = charIDToTypeID( "ohAA" );
                            desc4.putBoolean( idohAA, true );
                            var idohQA = charIDToTypeID( "ohQA" );
                            desc4.putBoolean( idohQA, true );
                            var idohCA = charIDToTypeID( "ohCA" );
                            desc4.putBoolean( idohCA, false );
                            var idohIZ = charIDToTypeID( "ohIZ" );
                            desc4.putBoolean( idohIZ, true );
                            var idohTC = charIDToTypeID( "ohTC" );
                            var idSToc = charIDToTypeID( "SToc" );
                            var idOCzerothree = charIDToTypeID( "OC03" );
                            desc4.putEnumerated( idohTC, idSToc, idOCzerothree );
                            var idohAC = charIDToTypeID( "ohAC" );
                            var idSToc = charIDToTypeID( "SToc" );
                            var idOCzerothree = charIDToTypeID( "OC03" );
                            desc4.putEnumerated( idohAC, idSToc, idOCzerothree );
                            var idohIn = charIDToTypeID( "ohIn" );
                            desc4.putInteger( idohIn, -1 );
                            var idohLE = charIDToTypeID( "ohLE" );
                            var idSTle = charIDToTypeID( "STle" );
                            var idLEzerothree = charIDToTypeID( "LE03" );
                            desc4.putEnumerated( idohLE, idSTle, idLEzerothree );
                            var idohEn = charIDToTypeID( "ohEn" );
                            var idSTen = charIDToTypeID( "STen" );
                            var idENzerozero = charIDToTypeID( "EN00" );
                            desc4.putEnumerated( idohEn, idSTen, idENzerozero );
                            var idolCS = charIDToTypeID( "olCS" );
                            desc4.putBoolean( idolCS, false );
                            var idolEC = charIDToTypeID( "olEC" );
                            var idSTst = charIDToTypeID( "STst" );
                            var idSTzerozero = charIDToTypeID( "ST00" );
                            desc4.putEnumerated( idolEC, idSTst, idSTzerozero );
                            var idolWH = charIDToTypeID( "olWH" );
                            var idSTwh = charIDToTypeID( "STwh" );
                            var idWHzeroone = charIDToTypeID( "WH01" );
                            desc4.putEnumerated( idolWH, idSTwh, idWHzeroone );
                            var idolSV = charIDToTypeID( "olSV" );
                            var idSTsp = charIDToTypeID( "STsp" );
                            var idSPzerofour = charIDToTypeID( "SP04" );
                            desc4.putEnumerated( idolSV, idSTsp, idSPzerofour );
                            var idolSH = charIDToTypeID( "olSH" );
                            var idSTsp = charIDToTypeID( "STsp" );
                            var idSPzerofour = charIDToTypeID( "SP04" );
                            desc4.putEnumerated( idolSH, idSTsp, idSPzerofour );
                            var idolNC = charIDToTypeID( "olNC" );
                                var list1 = new ActionList();
                                    var desc5 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCzerozero = charIDToTypeID( "NC00" );
                                    desc5.putEnumerated( idncTp, idSTnc, idNCzerozero );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc5 );
                                    var desc6 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNConenine = charIDToTypeID( "NC19" );
                                    desc6.putEnumerated( idncTp, idSTnc, idNConenine );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc6 );
                                    var desc7 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwoeight = charIDToTypeID( "NC28" );
                                    desc7.putEnumerated( idncTp, idSTnc, idNCtwoeight );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc7 );
                                    var desc8 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc8.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc8 );
                                    var desc9 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc9.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc9 );
                                    var desc10 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc10.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list1.putObject( idSCnc, desc10 );
                            desc4.putList( idolNC, list1 );
                            var idobIA = charIDToTypeID( "obIA" );
                            desc4.putBoolean( idobIA, false );
                            var idobIP = charIDToTypeID( "obIP" );
                            desc4.putString( idobIP, """""" );
                            var idobCS = charIDToTypeID( "obCS" );
                            var idSTcs = charIDToTypeID( "STcs" );
                            var idCSzeroone = charIDToTypeID( "CS01" );
                            desc4.putEnumerated( idobCS, idSTcs, idCSzeroone );
                            var idovNC = charIDToTypeID( "ovNC" );
                                var list2 = new ActionList();
                                    var desc11 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCzeroone = charIDToTypeID( "NC01" );
                                    desc11.putEnumerated( idncTp, idSTnc, idNCzeroone );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc11 );
                                    var desc12 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwozero = charIDToTypeID( "NC20" );
                                    desc12.putEnumerated( idncTp, idSTnc, idNCtwozero );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc12 );
                                    var desc13 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCzerotwo = charIDToTypeID( "NC02" );
                                    desc13.putEnumerated( idncTp, idSTnc, idNCzerotwo );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc13 );
                                    var desc14 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNConenine = charIDToTypeID( "NC19" );
                                    desc14.putEnumerated( idncTp, idSTnc, idNConenine );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc14 );
                                    var desc15 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCzerosix = charIDToTypeID( "NC06" );
                                    desc15.putEnumerated( idncTp, idSTnc, idNCzerosix );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc15 );
                                    var desc16 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc16.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc16 );
                                    var desc17 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc17.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc17 );
                                    var desc18 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwofour = charIDToTypeID( "NC24" );
                                    desc18.putEnumerated( idncTp, idSTnc, idNCtwofour );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc18 );
                                    var desc19 = new ActionDescriptor();
                                    var idncTp = charIDToTypeID( "ncTp" );
                                    var idSTnc = charIDToTypeID( "STnc" );
                                    var idNCtwotwo = charIDToTypeID( "NC22" );
                                    desc19.putEnumerated( idncTp, idSTnc, idNCtwotwo );
                                var idSCnc = charIDToTypeID( "SCnc" );
                                list2.putObject( idSCnc, desc19 );
                            desc4.putList( idovNC, list2 );
                            var idovCM = charIDToTypeID( "ovCM" );
                            desc4.putBoolean( idovCM, false );
                            var idovCW = charIDToTypeID( "ovCW" );
                            desc4.putBoolean( idovCW, false );
                            var idovCU = charIDToTypeID( "ovCU" );
                            desc4.putBoolean( idovCU, true );
                            var idovSF = charIDToTypeID( "ovSF" );
                            desc4.putBoolean( idovSF, true );
                            var idovCB = charIDToTypeID( "ovCB" );
                            desc4.putBoolean( idovCB, true );
                            var idovSN = charIDToTypeID( "ovSN" );
                            desc4.putString( idovSN, """images""" );
                        var idSaveForWeb = stringIDToTypeID( "SaveForWeb" );
                        desc3.putObject( idUsng, idSaveForWeb, desc4 );
                    executeAction( idExpr, desc3, DialogModes.NO );
                    
                    • 7. Re: save for web options
                      essejesse Level 1

                      Just to make sure I understand how to modify these, I'd like to use a global variable that is determined by the input file's name and save location. I should be able to reference those variables in these spots, right?