9 Replies Latest reply on Apr 14, 2014 2:44 AM by c.pfaffenbichler

    ALL the options for ExportOptionsSaveForWeb()

    ZHack

      Hi,

       

      I'm looking for all the options for ExportOptionsSaveForWeb() -

      specifically on how to turn on (or off) the option "save as html".

       

      Thanks in advance!

       

      Jochen

        • 1. Re: ALL the options for ExportOptionsSaveForWeb()
          c.pfaffenbichler Level 9

          For the DOM properties please refer to ESTK’s Help > Object Model Viewer.

          If a feature is absent there you may have to resort to using ActionManager code (as recorded with ScriptingListener.plugin).

          • 2. Re: ALL the options for ExportOptionsSaveForWeb()
            ZHack Level 1

            Thanks for the help. I found the part i need (at least i think so), but how do i take this:

            var idSHTM = charIDToTypeID( "SHTM" );

                    desc22.putBoolean( idSHTM, true );

            and make it work here ?

            var options = new ExportOptionsSaveForWeb();

            options.quality = 65;

            options.format = SaveDocumentType.PNG;

            options.transparency = true;

            options.optimized = true;

             

            Thanks again for the help!

            • 3. Re: ALL the options for ExportOptionsSaveForWeb()
              c.pfaffenbichler Level 9

              You don’t, you need to use the Action Manager code for the whole process.

              • 4. Re: ALL the options for ExportOptionsSaveForWeb()
                ZHack Level 1

                Thanks - but there is another problem. As you propably guessed im trying to batch resize and rename. Could you point me to where i can rename in the action manager code? This is what i used until now:

                var Name = decodeURI(app.activeDocument.name).replace(/\.[^\.]+$/, '');

                var Name = Name.replace(identifier, '');

                var newName = Name+suffix+'.jpg';

                 

                doc.exportDocument(File(doc.path+'/'+newName),ExportType.SAVEFORWEB,options);

                I can find the path ("In ") but not the name.

                • 5. Re: ALL the options for ExportOptionsSaveForWeb()
                  c.pfaffenbichler Level 9

                  Wrap the AM code in a function that takes the things you may have to change as arguments and insert the arguments at the proper places in the code.

                  If that sounds obtuse pplease post the AM code.

                  • 6. Re: ALL the options for ExportOptionsSaveForWeb()
                    ZHack Level 1

                    Wrapping in a function wouldn't be the problem - finding the right argument and the proper place is. Here's the code the scriptlistener gave me:

                     

                        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( "C:\\MYPATH" ) );
                       
                        var idFmt = charIDToTypeID( "Fmt " );
                        var idIRFm = charIDToTypeID( "IRFm" );
                        var idPNtwofour = charIDToTypeID( "PN24" );
                        desc4.putEnumerated( idFmt, idIRFm, idPNtwofour );
                       
                        var idIntr = charIDToTypeID( "Intr" );
                        desc4.putBoolean( idIntr, false );
                       
                        var idTrns = charIDToTypeID( "Trns" );
                        desc4.putBoolean( idTrns, true );

                     

                        var idMtt = charIDToTypeID( "Mtt " );
                        desc4.putBoolean( idMtt, false );
                       
                        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 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();
                        car 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, true );
                        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: ALL the options for ExportOptionsSaveForWeb()
                      c.pfaffenbichler Level 9

                      The code was recorded, it seems, when you did not change the name in the Save for Web so a change of the name is not part of it.

                      1 person found this helpful
                      • 8. Re: ALL the options for ExportOptionsSaveForWeb()
                        ZHack Level 1

                        Well, now i feel stupid ... recorded again (had to restart PS though) ... and found it. Thanks again.

                        • 9. Re: ALL the options for ExportOptionsSaveForWeb()
                          c.pfaffenbichler Level 9

                          Don’t.

                          Using AM code takes some getting used to …