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

Scriptlistener: scripting save as GIF with loop endless and file name as layer name

Explorer ,
Jul 21, 2017 Jul 21, 2017

I have script to export to animated GIF that gives

the file name after the name of the selected Photoshop layer.

It works fine but Looping options is always

set to "ONCE". I need looping to be set "FOREVER".

To solve the problem I am trying to use scriptlistener.

The scriptlistener produces proper .GIF with loop

endless BUT I cannot integrate it properly into

my script that sets the name of the file as

the name of the currently selected layer.

I think the problem is that with scriptlistener

I am using Save For WEB to produce GIF file with

Looping Options: forever. So it just overrides

the file name with new always the same name!

Is there any other way to set loop forever except 

Save For WEB function? What should I log by scriptlistener?

Or how I can use scriptlistener's log in this my script?

PLEASE HELP!!! WOULD BE VERY GRATEFULL!!!

------- here is my script -----------

#target photoshop

main();

function main(){

if(!documents.length) return;

try{

var Path= activeDocument.path;

}catch(e){var Path = "~/desktop";}

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

var layerName = app.activeDocument.activeLayer.name.replace(/[:\/\\*\?\"\<\>\|]/g, "_");

var saveFile= new File(Path + "/" + Name + "-" + layerName + ".gif");

SaveForWeb(saveFile);

}

function SaveForWeb(saveFile) {

var sfwOptions = new ExportOptionsSaveForWeb();

   sfwOptions.format = SaveDocumentType.COMPUSERVEGIF;

   sfwOptions.includeProfile = false;

   sfwOptions.interlaced = 1;

   sfwOptions.optimized = true;

   sfwOptions.transparency = 1;

   sfwOptions.ColorReductionType = ColorReductionType.SELECTIVE;

   sfwOptions.dither = Dither.NONE;  

   sfwOptions.ditherAmount = 80;

   sfwOptions.webSnap = 0;

   sfwOptions.colors = 128;

activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);

}

--------- END of my script -------------------

----------here is

#target photoshop

main();

function main(){

if(!documents.length) return;

try{

var Path= activeDocument.path;

}catch(e){var Path = "~/desktop";}

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

var layerName = app.activeDocument.activeLayer.name.replace(/[:\/\\*\?\"\<\>\|]/g, "_");

var saveFile= new File(Path + "/" + Name + "-" + layerName + ".gif");

makeGif(saveFile);

}

function makeGif(saveFile){ 

// ======================================================= 

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( "D:\\==Result\\10-10" ) ); 

        var idovFN = charIDToTypeID( "ovFN" ); 

        desc4.putString( idovFN, saveFile );//new line 

//        desc4.putString( idovFN, """capricia2.gif""" ); Old line 

        var idFmt = charIDToTypeID( "Fmt " ); 

        var idIRFm = charIDToTypeID( "IRFm" ); 

        var idGIFf = charIDToTypeID( "GIFf" ); 

        desc4.putEnumerated( idFmt, idIRFm, idGIFf ); 

        var idIntr = charIDToTypeID( "Intr" ); 

        desc4.putBoolean( idIntr, true ); 

        var idRedA = charIDToTypeID( "RedA" ); 

        var idIRRd = charIDToTypeID( "IRRd" ); 

        var idSltv = charIDToTypeID( "Sltv" ); 

        desc4.putEnumerated( idRedA, idIRRd, idSltv ); 

        var idRChT = charIDToTypeID( "RChT" ); 

        desc4.putBoolean( idRChT, false ); 

        var idRChV = charIDToTypeID( "RChV" ); 

        desc4.putBoolean( idRChV, false ); 

        var idAuRd = charIDToTypeID( "AuRd" ); 

        desc4.putBoolean( idAuRd, false ); 

        var idNCol = charIDToTypeID( "NCol" ); 

        desc4.putInteger( idNCol, 128 ); 

        var idDChS = charIDToTypeID( "DChS" ); 

        desc4.putInteger( idDChS, 0 ); 

        var idDCUI = charIDToTypeID( "DCUI" ); 

        desc4.putInteger( idDCUI, 0 ); 

        var idDChT = charIDToTypeID( "DChT" ); 

        desc4.putBoolean( idDChT, false ); 

        var idDChV = charIDToTypeID( "DChV" ); 

        desc4.putBoolean( idDChV, false ); 

        var idWebS = charIDToTypeID( "WebS" ); 

        desc4.putInteger( idWebS, 0 ); 

        var idTDth = charIDToTypeID( "TDth" ); 

        var idIRDt = charIDToTypeID( "IRDt" ); 

        var idPtrn = charIDToTypeID( "Ptrn" ); 

        desc4.putEnumerated( idTDth, idIRDt, idPtrn ); 

        var idTDtA = charIDToTypeID( "TDtA" ); 

        desc4.putInteger( idTDtA, 100 ); 

        var idLoss = charIDToTypeID( "Loss" ); 

        desc4.putInteger( idLoss, 0 ); 

        var idLChS = charIDToTypeID( "LChS" ); 

        desc4.putInteger( idLChS, 0 ); 

        var idLCUI = charIDToTypeID( "LCUI" ); 

        desc4.putInteger( idLCUI, 100 ); 

        var idLChT = charIDToTypeID( "LChT" ); 

        desc4.putBoolean( idLChT, false ); 

        var idLChV = charIDToTypeID( "LChV" ); 

        desc4.putBoolean( idLChV, false ); 

        var idTrns = charIDToTypeID( "Trns" ); 

        desc4.putBoolean( idTrns, true ); 

        var idMtt = charIDToTypeID( "Mtt " ); 

        desc4.putBoolean( idMtt, false ); 

        var idDthr = charIDToTypeID( "Dthr" ); 

        var idIRDt = charIDToTypeID( "IRDt" ); 

        var idNone = charIDToTypeID( "None" ); 

        desc4.putEnumerated( idDthr, idIRDt, idNone ); 

        var idDthA = charIDToTypeID( "DthA" ); 

        desc4.putInteger( idDthA, 54 ); 

        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 idMDCp = charIDToTypeID( "MDCp" ); 

        desc4.putEnumerated( idSWmd, idSTmd, idMDCp ); 

        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, 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 ); 

}

------- END of scriptlistener ---------------

TOPICS
Actions and scripting
5.0K
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
Community Expert ,
Jul 23, 2017 Jul 23, 2017

On more thing you can test. Comment out the close no save statement. and run the script on the psd.  In the end you should have two document open in Photoshop. Thes PSD and the GIF the gif's forever shoul be set in the timeline.

//activeDocument.close(SaveOptions.DONOTSAVECHANGES); //close Gif 

Capture.jpg

JJMack
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
Explorer ,
Jul 23, 2017 Jul 23, 2017

2017-07-23_17-31-55.jpg2017-07-23_17-32-58.jpg

2017-07-23_17-33-45.jpg

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
Community Expert ,
Jul 23, 2017 Jul 23, 2017

So it look like the script is working however the second save for web did not work and overwrite the gif on disk. What you could try is to change the name used on the second saved for web. Add this statement right before the second save for web...

var saveFile= new File(Path + "/" + Name + "-Anim" + ".gif");   

You should then wind up with two gif on your desktop. One that loops one that does not.

Capture.jpg

JJMack
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
Explorer ,
Jul 23, 2017 Jul 23, 2017

2017-07-23_17-58-38.jpg

2017-07-23_18-05-01.jpg

I do have 2 files...

2017-07-23_18-06-55.jpg

2017-07-23_18-07-39.jpg

The result -  9-gif-Animation.gif  loops just once.

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
Explorer ,
Jul 23, 2017 Jul 23, 2017

Maybe it is easier to use Gifslie? Besides file name after layer name is really CRUCIAL for my workflow.

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
Guide ,
Jul 23, 2017 Jul 23, 2017

Please try this version...

#target photoshop;

try{

var Path= activeDocument.path;

}catch(e){var Path = "~/desktop";}

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

var layerName = app.activeDocument.activeLayer.name.replace(/[:\/\\*\?\"\<\>\|]/g, "_");

var saveFile= new File(Path + "/" + Name + "-" + layerName + ".gif");

saveGif(saveFile);

function saveGif(saveFile) {

var desc4 = new ActionDescriptor();

var desc5 = new ActionDescriptor();

desc5.putEnumerated( charIDToTypeID('Op  '), charIDToTypeID('SWOp'), charIDToTypeID('OpSa') );

desc5.putPath( charIDToTypeID('In  '), new File( saveFile ) );

desc5.putEnumerated( charIDToTypeID('Fmt '), charIDToTypeID('IRFm'), charIDToTypeID('GIFf') );

desc5.putBoolean( charIDToTypeID('Intr'), true );

desc5.putEnumerated( charIDToTypeID('RedA'), charIDToTypeID('IRRd'), charIDToTypeID('Sltv') );

desc5.putBoolean( charIDToTypeID('RChT'), false );

desc5.putBoolean( charIDToTypeID('RChV'), false );

desc5.putBoolean( charIDToTypeID('AuRd'), false );

desc5.putInteger( charIDToTypeID('NCol'), 128 );

desc5.putEnumerated( charIDToTypeID('Dthr'), charIDToTypeID('IRDt'), charIDToTypeID('None') );

desc5.putInteger( charIDToTypeID('DthA'), 80 );

desc5.putInteger( charIDToTypeID('DChS'), 0 );

desc5.putInteger( charIDToTypeID('DCUI'), 0 );

desc5.putBoolean( charIDToTypeID('DChT'), false );

desc5.putBoolean( charIDToTypeID('DChV'), false );

desc5.putInteger( charIDToTypeID('WebS'), 0 );

desc5.putEnumerated( charIDToTypeID('TDth'), charIDToTypeID('IRDt'), charIDToTypeID('None') );

desc5.putInteger( charIDToTypeID('TDtA'), 100 );

desc5.putInteger( charIDToTypeID('Loss'), 60 );

desc5.putInteger( charIDToTypeID('LChS'), 0 );

desc5.putInteger( charIDToTypeID('LCUI'), 100 );

desc5.putBoolean( charIDToTypeID('LChT'), false );

desc5.putBoolean( charIDToTypeID('LChV'), false );

desc5.putBoolean( charIDToTypeID('Trns'), true );

desc5.putBoolean( charIDToTypeID('Mtt '), false );

desc5.putInteger( charIDToTypeID('MttR'), 255 );

desc5.putInteger( charIDToTypeID('MttG'), 255 );

desc5.putInteger( charIDToTypeID('MttB'), 255 );

desc5.putBoolean( charIDToTypeID('SHTM'), false );

desc5.putBoolean( charIDToTypeID('SImg'), true );

desc5.putEnumerated( charIDToTypeID('SWsl'), charIDToTypeID('STsl'), charIDToTypeID('SLAl') );

desc5.putEnumerated( charIDToTypeID('SWch'), charIDToTypeID('STch'), charIDToTypeID('CHsR') );

desc5.putEnumerated( charIDToTypeID('SWmd'), charIDToTypeID('STmd'), charIDToTypeID('MDCC') );

desc5.putBoolean( charIDToTypeID('ohXH'), false );

desc5.putBoolean( charIDToTypeID('ohIC'), true );

desc5.putBoolean( charIDToTypeID('ohAA'), true );

desc5.putBoolean( charIDToTypeID('ohQA'), true );

desc5.putBoolean( charIDToTypeID('ohCA'), false );

desc5.putBoolean( charIDToTypeID('ohIZ'), true );

desc5.putEnumerated( charIDToTypeID('ohTC'), charIDToTypeID('SToc'), charIDToTypeID('OC03') );

desc5.putEnumerated( charIDToTypeID('ohAC'), charIDToTypeID('SToc'), charIDToTypeID('OC03') );

desc5.putInteger( charIDToTypeID('ohIn'), -1 );

desc5.putEnumerated( charIDToTypeID('ohLE'), charIDToTypeID('STle'), charIDToTypeID('LE03') );

desc5.putEnumerated( charIDToTypeID('ohEn'), charIDToTypeID('STen'), charIDToTypeID('EN00') );

desc5.putBoolean( charIDToTypeID('olCS'), false );

desc5.putEnumerated( charIDToTypeID('olEC'), charIDToTypeID('STst'), charIDToTypeID('ST00') );

desc5.putEnumerated( charIDToTypeID('olWH'), charIDToTypeID('STwh'), charIDToTypeID('WH01') );

desc5.putEnumerated( charIDToTypeID('olSV'), charIDToTypeID('STsp'), charIDToTypeID('SP04') );

desc5.putEnumerated( charIDToTypeID('olSH'), charIDToTypeID('STsp'), charIDToTypeID('SP04') );

var list1 = new ActionList();

var desc6 = new ActionDescriptor();

desc6.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC00') );

list1.putObject( charIDToTypeID('SCnc'), desc6 );

var desc7 = new ActionDescriptor();

desc7.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC19') );

list1.putObject( charIDToTypeID('SCnc'), desc7 );

var desc8 = new ActionDescriptor();

desc8.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC28') );

list1.putObject( charIDToTypeID('SCnc'), desc8 );

var desc9 = new ActionDescriptor();

desc9.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list1.putObject( charIDToTypeID('SCnc'), desc9 );

var desc10 = new ActionDescriptor();

desc10.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list1.putObject( charIDToTypeID('SCnc'), desc10 );

var desc11 = new ActionDescriptor();

desc11.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list1.putObject( charIDToTypeID('SCnc'), desc11 );

desc5.putList( charIDToTypeID('olNC'), list1 );

desc5.putBoolean( charIDToTypeID('obIA'), false );

desc5.putString( charIDToTypeID('obIP'), '' );

desc5.putEnumerated( charIDToTypeID('obCS'), charIDToTypeID('STcs'), charIDToTypeID('CS01') );

var list2 = new ActionList();

var desc12 = new ActionDescriptor();

desc12.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC01') );

list2.putObject( charIDToTypeID('SCnc'), desc12 );

var desc13 = new ActionDescriptor();

desc13.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC20') );

list2.putObject( charIDToTypeID('SCnc'), desc13 );

var desc14 = new ActionDescriptor();

desc14.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC02') );

list2.putObject( charIDToTypeID('SCnc'), desc14 );

var desc15 = new ActionDescriptor();

desc15.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC19') );

list2.putObject( charIDToTypeID('SCnc'), desc15 );

var desc16 = new ActionDescriptor();

desc16.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC06') );

list2.putObject( charIDToTypeID('SCnc'), desc16 );

var desc17 = new ActionDescriptor();

desc17.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list2.putObject( charIDToTypeID('SCnc'), desc17 );

var desc18 = new ActionDescriptor();

desc18.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list2.putObject( charIDToTypeID('SCnc'), desc18 );

var desc19 = new ActionDescriptor();

desc19.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC24') );

list2.putObject( charIDToTypeID('SCnc'), desc19 );

var desc20 = new ActionDescriptor();

desc20.putEnumerated( charIDToTypeID('ncTp'), charIDToTypeID('STnc'), charIDToTypeID('NC22') );

list2.putObject( charIDToTypeID('SCnc'), desc20 );

desc5.putList( charIDToTypeID('ovNC'), list2 );

desc5.putBoolean( charIDToTypeID('ovCM'), false );

desc5.putBoolean( charIDToTypeID('ovCW'), true );

desc5.putBoolean( charIDToTypeID('ovCU'), true );

desc5.putBoolean( charIDToTypeID('ovSF'), true );

desc5.putBoolean( charIDToTypeID('ovCB'), true );

desc5.putString( charIDToTypeID('ovSN'), 'images' );

desc4.putObject( charIDToTypeID('Usng'), stringIDToTypeID('SaveForWeb'), desc5 );

executeAction( charIDToTypeID('Expr'), desc4, DialogModes.NO );

};

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
Explorer ,
Jul 23, 2017 Jul 23, 2017

... something went wrong ... the script is running ... but no file (nothing at all) produced...

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
Guide ,
Jul 23, 2017 Jul 23, 2017

I had missed a setting and it does work in CS6 Windows when I tested it.

Sorry but I don't have CC.

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
Explorer ,
Jul 23, 2017 Jul 23, 2017

I see... thank you for your time, anyway!

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
Community Expert ,
Jul 23, 2017 Jul 23, 2017

Cyril500  wrote

Maybe it is easier to use Gifslie? Besides file name after layer name is really CRUCIAL for my workflow.

If the layer name is critical and there is no blank in it would not be a problem if the script worked on your machine.  It works without problem on my machine.  IMO you have a problem on your machine.  If you want to use Gifslie that is fine with me.   However you should not try to add it to the script.  You do not have the skill and you seem to have a problem on your machine.  The Protrace script I posted has code the will execute an external exe. If you want to try to add the exe into your script. I have tested the script using CS6 and CC 2017 one my machine.  Both Photoshop versions work. CS6 produces a slightly smaller gif.  Here is what I see in CS6.

Capture.jpg

9-gif-114.gif

JJMack
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
Explorer ,
Jul 23, 2017 Jul 23, 2017

... I do not encounter any problem with the machine or soft, like Photoshop, so far ...  this is the first one ...

Besides, it works as you say but the result gif file loops just once, as in my script.

Anyway, JJMack, thank you very much for your time!!! Your help is greatly appreciated!!!

I really do not have the knowledge base to integrate Gifslie string into my script... that is exactly why I am looking for help on this forum

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
Guide ,
Jul 23, 2017 Jul 23, 2017

Sorry about that, it did work for me using CS6 and Windows.

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
Explorer ,
Jul 23, 2017 Jul 23, 2017

Thank you for answering! I need it for PS CC 2017...

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
Community Expert ,
Jul 23, 2017 Jul 23, 2017

Cyril500  wrote

Could you please tell how to include this string "C://gifsicle.exe --batch --loop=forever −−careful *.gif " into that script?

That would require much more complex code then Open, Set, Save, Close.  Here is a script I use protrace.exe in.  If you want you can look at its code and hack something like it into your script.

/* ==========================================================

// 2014  John J. McAssey (JJMack)

// ======================================================= */

// This script is supplied as is. It is provided as freeware.

// The author accepts no liability for any problems arising from its use.

/* Help Category note tag menu can be used to place script in automate menu

<javascriptresource>

<about>$$$/JavaScripts/potrace/About=JJMack's protrace Script.^r^rCopyright 2014 Mouseprints.^r^rDefine custom shape for the document and add shape layer on top </about>

<category>JJMack's Script</category>

</javascriptresource>

*/

// enable double-clicking from Mac Finder or Windows Explorer

#target photoshop // this command only works in Photoshop CS2 and higher

// bring application forward for double-click events

app.bringToFront();

// ensure at least one document open

if (!documents.length) alert('There are no documents open.', 'No Document');

else {

// declare Global variables

//main(); // at least one document exists proceed

app.activeDocument.suspendHistory('portace','main()');

}

///////////////////////////////////////////////////////////////////////////////

//                            main function                                  //

///////////////////////////////////////////////////////////////////////////////

function main() {

// declare local variables

var orig_ruler_units = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS; // Set the ruler units to PIXELS

try {code();}

catch(e) {alert(e + ': on line ' + e.line, 'Script Error', true);} // display error message if something goes wrong

app.preferences.rulerUnits = orig_ruler_units; // Reset units to original settings

}

///////////////////////////////////////////////////////////////////////////////

//                           main function end                               //

///////////////////////////////////////////////////////////////////////////////

function code() {

var scriptLocation = String(findScript());

var replacewithblanks = "";

while (scriptLocation.indexOf("%20") != -1 ) {

   replacewithblanks = replacewithblanks + scriptLocation.substr(0, scriptLocation.indexOf("%20")) + " ";

scriptLocation = scriptLocation.substr(scriptLocation.indexOf("%20") + 3 ,);

}

scriptLocation = replacewithblanks + scriptLocation;

var path = "";

if(scriptLocation.indexOf("/") ==  0 ) {

path = path + scriptLocation.substr(1, 1) + ":\\";

scriptLocation = scriptLocation.substr(scriptLocation.indexOf("/") + 3 ,);

}

while (scriptLocation.indexOf("/") != -1 ) {

path= path + scriptLocation.substr(0, scriptLocation.indexOf("/")) + "\\";

scriptLocation = scriptLocation.substr(scriptLocation.indexOf("/") + 1 ,);

}

scriptLocation = path + scriptLocation;

var program = path + "potrace.exe";

var options="";  

//options=prompt("Enter any Potrace options",options);                               // Best to default and just work on source image

var Name = app.activeDocument.name;                                                 // get name 

if (Name.indexOf(".") != -1 ) Name=Name.substr(0,Name.lastIndexOf("."));            // strip off any extension

Name=Name + " " + suffix();                                                         // add a suffix

var testpbm = new File(Folder.temp + "/" + Name +".pbm");                           // output pbm files

if (testpbm.exists) testpbm.remove();                                               // delete if it exists

var testeps = new File(Folder.temp + "/" + Name +".eps");                           // output eps files

if (testeps.exists) testeps.remove();                                               // delete if it exists

app.activeDocument.artLayers.add();                                                 // Add a Layer so save will not switch documents

SavePBM(testpbm);                                                                   // save active document as a pbm file 

app.activeDocument.activeLayer.remove();                                            // remove added layer

if (!testpbm.exists) {alert('Could not save "' + testpbm + '"'); return;}           // return if it did not save as a pbm

var pbmName = $.getenv("USERPROFILE") +"\\AppData\\Local\\Temp\\"  + Name + ".pbm"; // develop standard windows file name of pbm file

StartPgm(path,program,options,pbmName);                                             // Create eps file

app.refresh();                                                                      // slow down Photoshop with a refresh

for (var i=0;i<100000;i++) { if (!testeps.exists) break; }                          // wait a short time before forcing a pause

if (!testeps.exists) {alert('File "' + testeps + '" was not cteated yet'); }        // force a pause

if (!testeps.exists) {alert('File "' + testeps + '" was not cteated'); return;}     // failed to create the eps file

//app.load(testeps); // load it into a document

openEPS(testeps); // load it into a document use 72 dpi

var sb=DefineShape(Name);                                                           // define custom shape

if (sb!= false) {                                                                   // shape bounds not false

var layers = app.activeDocument.layers;                                         // get layers

app.activeDocument.activeLayer = layers[0];                                    // target top layer

addShape(Name,sb);                                                              // add shape layer to fit canvas

app.activeDocument.activeLayer.name=Name;                                       // tell User the custom shape name is defined

}

else alert('Custom Shape define failed');                                           // tell User the custom shape define failed

}

///////////////////////////////////////////////////////////////////////////////

//                             Start external Program                        //

///////////////////////////////////////////////////////////////////////////////

function StartPgm(pth,pgm,opt,file){

var pgmfile = new File(pgm);

  if(!pgmfile.exists){alert("Program missing 'protrace.exe'\rMust be with script in folder\r" + pth ); return; }

//alert('app.system(Start "' + pgm + '" /D "' + pth + '" /MIN "' + pgm + '" '  + opt + ' "' + file + '"' );

app.system('Start "' + pgm + '" /D  "' + pth + '" /MIN "'  + pgm + '" ' + opt + ' "' + file + '"'  );

};

function suffix() {

var now = (new Date()).valueOf();

var future = (new Date()).valueOf();

while(future == now){

future = (new Date()).valueOf();

}

return future;

}

///////////////////////////////////////////////////////////////////////////////

//        Helper functions mostly scriptlistener Action manager code         //

///////////////////////////////////////////////////////////////////////////////

function SavePBM(file){

var idsave = charIDToTypeID( "save" );

    var desc10 = new ActionDescriptor();

    var idAs = charIDToTypeID( "As  " );

    desc10.putString( idAs, """Portable Bit Map""" );

    var idIn = charIDToTypeID( "In  " );

    desc10.putPath( idIn, new File( file ) );

    var idDocI = charIDToTypeID( "DocI" );

    desc10.putInteger( idDocI, 344 );

    var idsaveStage = stringIDToTypeID( "saveStage" );

    var idsaveStageType = stringIDToTypeID( "saveStageType" );

    var idsaveBegin = stringIDToTypeID( "saveBegin" );

    desc10.putEnumerated( idsaveStage, idsaveStageType, idsaveBegin );

executeAction( idsave, desc10, DialogModes.NO );

var idsave = charIDToTypeID( "save" );

    var desc11 = new ActionDescriptor();

    var idAs = charIDToTypeID( "As  " );

    desc11.putString( idAs, """Portable Bit Map""" );

    var idIn = charIDToTypeID( "In  " );

    desc11.putPath( idIn, new File( file ) );

    var idDocI = charIDToTypeID( "DocI" );

    desc11.putInteger( idDocI, 344 );

    var idsaveStage = stringIDToTypeID( "saveStage" );

    var idsaveStageType = stringIDToTypeID( "saveStageType" );

    var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );

    desc11.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );

executeAction( idsave, desc11, DialogModes.NO );

}

function openEPS(file) {

var idOpn = charIDToTypeID( "Opn " );

var desc10 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

desc10.putPath( idnull, new File( file ) );

var idAs = charIDToTypeID( "As  " );

var desc11 = new ActionDescriptor();

var idRslt = charIDToTypeID( "Rslt" );

var idRsl = charIDToTypeID( "#Rsl" );

desc11.putUnitDouble( idRslt, idRsl, 72.000000 );

var idAntA = charIDToTypeID( "AntA" );

desc11.putBoolean( idAntA, true );

var idEPSG = charIDToTypeID( "EPSG" );

desc10.putObject( idAs, idEPSG, desc11 );

var idDocI = charIDToTypeID( "DocI" );

desc10.putInteger( idDocI, 545 );

executeAction( idOpn, desc10, DialogModes.NO );

}

function DefineShape(name) {

var rc=false;                                      // set return code to false

try {

// Select Current Layers Transparency

var idsetd = charIDToTypeID( "setd" );

var desc40 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref12 = new ActionReference();

var idChnl = charIDToTypeID( "Chnl" );

var idfsel = charIDToTypeID( "fsel" );

ref12.putProperty( idChnl, idfsel );

desc40.putReference( idnull, ref12 );

var idT = charIDToTypeID( "T   " );

var ref13 = new ActionReference();

var idChnl = charIDToTypeID( "Chnl" );

var idChnl = charIDToTypeID( "Chnl" );

var idTrsp = charIDToTypeID( "Trsp" );

ref13.putEnumerated( idChnl, idChnl, idTrsp );

desc40.putReference( idT, ref13 );

executeAction( idsetd, desc40, DialogModes.NO );

var SB = app.activeDocument.selection.bounds; // Get the bounds of the selection

top=SB[1].value;

left=SB[0].value;

bottom=SB[3].value;

right=SB[2].value;

rc=top + ":" + left + ":" + bottom + ":" + right;

// Convert selection to path

var idMk = charIDToTypeID( "Mk  " );

var desc41 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref14 = new ActionReference();

var idPath = charIDToTypeID( "Path" );

ref14.putClass( idPath );

desc41.putReference( idnull, ref14 );

var idFrom = charIDToTypeID( "From" );

var ref15 = new ActionReference();

var idcsel = charIDToTypeID( "csel" );

var idfsel = charIDToTypeID( "fsel" );

ref15.putProperty( idcsel, idfsel );

desc41.putReference( idFrom, ref15 );

var idTlrn = charIDToTypeID( "Tlrn" );

var idPxl = charIDToTypeID( "#Pxl" );

desc41.putUnitDouble( idTlrn, idPxl, 2.000000 );

executeAction( idMk, desc41, DialogModes.NO );

// would be good to delete any existing custom shape with this name but Photoshop

// deletes custom shapes by index not name.

// So I add a suffix to the name to make shape names unique.

// define custom shape

var idMk = charIDToTypeID( "Mk  " );

var desc42 = new ActionDescriptor();

var idnull = charIDToTypeID( "null" );

var ref16 = new ActionReference();

var idcustomShape = stringIDToTypeID( "customShape" );

ref16.putClass( idcustomShape );

desc42.putReference( idnull, ref16 );

var idUsng = charIDToTypeID( "Usng" );

var ref17 = new ActionReference();

var idPrpr = charIDToTypeID( "Prpr" );

var idfsel = charIDToTypeID( "fsel" );

ref17.putProperty( idPrpr, idfsel );

var idDcmn = charIDToTypeID( "Dcmn" );

var idOrdn = charIDToTypeID( "Ordn" );

var idTrgt = charIDToTypeID( "Trgt" );

ref17.putEnumerated( idDcmn, idOrdn, idTrgt );

desc42.putReference( idUsng, ref17 );

var idNm = charIDToTypeID( "Nm  " );

desc42.putString( idNm, name );

executeAction( idMk, desc42, DialogModes.NO );

}

//catch(e) {alert(e + ': on line ' + e.line, 'Script Error', true); rc=false; } // display error message if something goes wrong

catch(e) { rc=false; }                                                          // set return code false

app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes

return rc ;

}

function addShape(name,bounds) {

top=bounds.substr(0,bounds.indexOf(":")); bounds=bounds.substr(bounds.indexOf(":")+1);

left=bounds.substr(0,bounds.indexOf(":")); bounds=bounds.substr(bounds.indexOf(":")+1);

bottom=bounds.substr(0,bounds.indexOf(":")); right=bounds.substr(bounds.indexOf(":")+1);

// Add a Shape at resolution Black Fill no stroke

var idMk = charIDToTypeID( "Mk  " );

    var desc139 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var ref69 = new ActionReference();

        var idcontentLayer = stringIDToTypeID( "contentLayer" );

        ref69.putClass( idcontentLayer );

    desc139.putReference( idnull, ref69 );

    var idUsng = charIDToTypeID( "Usng" );

        var desc140 = new ActionDescriptor();

        var idType = charIDToTypeID( "Type" );

            var desc141 = new ActionDescriptor();

            var idClr = charIDToTypeID( "Clr " );

                var desc142 = new ActionDescriptor();

                var idRd = charIDToTypeID( "Rd  " );

                desc142.putDouble( idRd, 0.000000 );

                var idGrn = charIDToTypeID( "Grn " );

                desc142.putDouble( idGrn, 0.000000 );

                var idBl = charIDToTypeID( "Bl  " );

                desc142.putDouble( idBl, 0.000000 );

            var idRGBC = charIDToTypeID( "RGBC" );

            desc141.putObject( idClr, idRGBC, desc142 );

        var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );

        desc140.putObject( idType, idsolidColorLayer, desc141 );

        var idShp = charIDToTypeID( "Shp " );

            var desc143 = new ActionDescriptor();

            var idNm = charIDToTypeID( "Nm  " );

            desc143.putString( idNm, name );

            var idTop = charIDToTypeID( "Top " );

            var idPxl = charIDToTypeID( "#Pxl" );

            desc143.putUnitDouble( idTop, idPxl, top );

            var idLeft = charIDToTypeID( "Left" );

            var idPxl = charIDToTypeID( "#Pxl" );

            desc143.putUnitDouble( idLeft, idPxl, left );

            var idBtom = charIDToTypeID( "Btom" );

            var idPxl = charIDToTypeID( "#Pxl" );

            desc143.putUnitDouble( idBtom, idPxl, bottom );

            var idRght = charIDToTypeID( "Rght" );

            var idPxl = charIDToTypeID( "#Pxl" );

            desc143.putUnitDouble( idRght, idPxl, right );

        var idcustomShape = stringIDToTypeID( "customShape" );

        desc140.putObject( idShp, idcustomShape, desc143 );

        var idstrokeStyle = stringIDToTypeID( "strokeStyle" );

            var desc144 = new ActionDescriptor();

            var idstrokeStyleVersion = stringIDToTypeID( "strokeStyleVersion" );

            desc144.putInteger( idstrokeStyleVersion, 2 );

            var idstrokeEnabled = stringIDToTypeID( "strokeEnabled" );

            desc144.putBoolean( idstrokeEnabled, false );

            var idfillEnabled = stringIDToTypeID( "fillEnabled" );

            desc144.putBoolean( idfillEnabled, true );

            var idstrokeStyleLineWidth = stringIDToTypeID( "strokeStyleLineWidth" );

            var idPnt = charIDToTypeID( "#Pnt" );

            desc144.putUnitDouble( idstrokeStyleLineWidth, idPnt, 2.000000 );

            var idstrokeStyleLineDashOffset = stringIDToTypeID( "strokeStyleLineDashOffset" );

            var idPnt = charIDToTypeID( "#Pnt" );

            desc144.putUnitDouble( idstrokeStyleLineDashOffset, idPnt, 0.000000 );

            var idstrokeStyleMiterLimit = stringIDToTypeID( "strokeStyleMiterLimit" );

            desc144.putDouble( idstrokeStyleMiterLimit, 100.000000 );

            var idstrokeStyleLineCapType = stringIDToTypeID( "strokeStyleLineCapType" );

            var idstrokeStyleLineCapType = stringIDToTypeID( "strokeStyleLineCapType" );

            var idstrokeStyleButtCap = stringIDToTypeID( "strokeStyleButtCap" );

            desc144.putEnumerated( idstrokeStyleLineCapType, idstrokeStyleLineCapType, idstrokeStyleButtCap );

            var idstrokeStyleLineJoinType = stringIDToTypeID( "strokeStyleLineJoinType" );

            var idstrokeStyleLineJoinType = stringIDToTypeID( "strokeStyleLineJoinType" );

            var idstrokeStyleMiterJoin = stringIDToTypeID( "strokeStyleMiterJoin" );

            desc144.putEnumerated( idstrokeStyleLineJoinType, idstrokeStyleLineJoinType, idstrokeStyleMiterJoin );

            var idstrokeStyleLineAlignment = stringIDToTypeID( "strokeStyleLineAlignment" );

            var idstrokeStyleLineAlignment = stringIDToTypeID( "strokeStyleLineAlignment" );

            var idstrokeStyleAlignInside = stringIDToTypeID( "strokeStyleAlignInside" );

            desc144.putEnumerated( idstrokeStyleLineAlignment, idstrokeStyleLineAlignment, idstrokeStyleAlignInside );

            var idstrokeStyleScaleLock = stringIDToTypeID( "strokeStyleScaleLock" );

            desc144.putBoolean( idstrokeStyleScaleLock, false );

            var idstrokeStyleStrokeAdjust = stringIDToTypeID( "strokeStyleStrokeAdjust" );

            desc144.putBoolean( idstrokeStyleStrokeAdjust, false );

            var idstrokeStyleLineDashSet = stringIDToTypeID( "strokeStyleLineDashSet" );

                var list13 = new ActionList();

            desc144.putList( idstrokeStyleLineDashSet, list13 );

            var idstrokeStyleBlendMode = stringIDToTypeID( "strokeStyleBlendMode" );

            var idBlnM = charIDToTypeID( "BlnM" );

            var idNrml = charIDToTypeID( "Nrml" );

            desc144.putEnumerated( idstrokeStyleBlendMode, idBlnM, idNrml );

            var idstrokeStyleOpacity = stringIDToTypeID( "strokeStyleOpacity" );

            var idPrc = charIDToTypeID( "#Prc" );

            desc144.putUnitDouble( idstrokeStyleOpacity, idPrc, 100.000000 );

            var idstrokeStyleContent = stringIDToTypeID( "strokeStyleContent" );

                var desc145 = new ActionDescriptor();

                var idClr = charIDToTypeID( "Clr " );

                    var desc146 = new ActionDescriptor();

                    var idRd = charIDToTypeID( "Rd  " );

                    desc146.putDouble( idRd, 85.998688 );

                    var idGrn = charIDToTypeID( "Grn " );

                    desc146.putDouble( idGrn, 37.003326 );

                    var idBl = charIDToTypeID( "Bl  " );

                    desc146.putDouble( idBl, 17.999725 );

                var idRGBC = charIDToTypeID( "RGBC" );

                desc145.putObject( idClr, idRGBC, desc146 );

            var idsolidColorLayer = stringIDToTypeID( "solidColorLayer" );

            desc144.putObject( idstrokeStyleContent, idsolidColorLayer, desc145 );

            var idstrokeStyleResolution = stringIDToTypeID( "strokeStyleResolution" );

            desc144.putDouble( idstrokeStyleResolution, 182.880005 );

        var idstrokeStyle = stringIDToTypeID( "strokeStyle" );

        desc140.putObject( idstrokeStyle, idstrokeStyle, desc144 );

    var idcontentLayer = stringIDToTypeID( "contentLayer" );

    desc139.putObject( idUsng, idcontentLayer, desc140 );

executeAction( idMk, desc139, DialogModes.NO );

// Toggle visibility of other layers

var idShw = charIDToTypeID( "Shw " );

    var desc694 = new ActionDescriptor();

    var idnull = charIDToTypeID( "null" );

        var list96 = new ActionList();

            var ref359 = new ActionReference();

            var idLyr = charIDToTypeID( "Lyr " );

            var idOrdn = charIDToTypeID( "Ordn" );

            var idTrgt = charIDToTypeID( "Trgt" );

            ref359.putEnumerated( idLyr, idOrdn, idTrgt );

        list96.putReference( ref359 );

    desc694.putList( idnull, list96 );

    var idTglO = charIDToTypeID( "TglO" );

    desc694.putBoolean( idTglO, true );

executeAction( idShw, desc694, DialogModes.NO );

}

// Find the location where this script resides

function findScript() {

var where = "";

try {

FORCEERROR = FORCERRROR;

}

catch(err) {

// alert(err.fileName);

// alert(File(err.fileName).exists);

where = File(err.fileName);

}

return where ;

}

JJMack
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
Explorer ,
Jul 23, 2017 Jul 23, 2017

Thank you for the example. I am trying to figure out, but my knowledge in scripting does not allow me to hack it and apply for my case...

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
Community Expert ,
Jul 23, 2017 Jul 23, 2017

Does it work or does it not work on your machine?????  If you can not hack you should not be asking for help hacking....

JJMack
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
Explorer ,
Dec 21, 2020 Dec 21, 2020

hey @JJMack thank you for this code snippet!

Somehow, I am not able to have ScriptListener plot out the AM code for changing number of loops for a GIF like it did for you.
Would you be able to share the AM code for setting a specific number of loops (i.e not "Forever"). I assume it is something with "Other(#).."?

thnx in advance!

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
Explorer ,
Dec 21, 2020 Dec 21, 2020
LATEST

Sorry @JJMack 

no need, i got it!
i thought it came from setup in "Save for Web" , but the looping is recroded from the timeline animation options. just recorded it.

 

thnx anyways, you rock!

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