Clean SL

Upload Photoshop Scripts, download Photoshop Scripts, Discussion and Support of Photoshop Scripts

Moderators: xbytor, DavideBarranca, Paul MR

renderTom
Posts: 1
Joined: Thu Sep 14, 2017 8:13 pm

Clean SL

Postby renderTom » Thu Sep 14, 2017 8:32 pm

Hey guys. Just wanted to check in and let you know I've released a photoshop script for cleaning Action Manager code Clean SL. It's free for everyone to use, so go nuts. Please let me know if you find some issues. Cheers.

https://bitbucket.org/rendertom/clean-sl/src

Clean SL (Clean ScriptingListenerJS.log) is a utility tool for Adobe Photoshop to clean up ScriptingListenerJS.log file.
Script performs multiple actions such as cleaning-up variable names and hoisting them to the top, wraps code block into function, converts charID to string ID and such. Resulting code is clean and maintains better readability.

Features:
  • Load entire ScriptingListenerJS.log content
  • Load only last entry in ScriptingListenerJS.log
  • Enter ScriptingListenerJScode manually

Options
  • Hoist variable declaration to the top
  • Consolidate variables
  • Give descriptive variable names
  • Convert charID to stringID for better readability
  • Replace stringIDToTypeID() to s2t() function
  • Wrap to function block
  • Close Clean SL window before evaluating code
  • Save UI data on script quit.

Example:
From this:

Code: Select all

var idMk = charIDToTypeID( "Mk  " );
    var desc4 = new ActionDescriptor();
    var idNw = charIDToTypeID( "Nw  " );
        var desc5 = new ActionDescriptor();
        var idartboard = stringIDToTypeID( "artboard" );
        desc5.putBoolean( idartboard, false );
        var idMd = charIDToTypeID( "Md  " );
        var idRGBM = charIDToTypeID( "RGBM" );
        desc5.putClass( idMd, idRGBM );
        var idWdth = charIDToTypeID( "Wdth" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc5.putUnitDouble( idWdth, idRlt, 1000.000000 );
        var idHght = charIDToTypeID( "Hght" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc5.putUnitDouble( idHght, idRlt, 1000.000000 );
        var idRslt = charIDToTypeID( "Rslt" );
        var idRsl = charIDToTypeID( "#Rsl" );
        desc5.putUnitDouble( idRslt, idRsl, 72.000000 );
        var idpixelScaleFactor = stringIDToTypeID( "pixelScaleFactor" );
        desc5.putDouble( idpixelScaleFactor, 1.000000 );
        var idFl = charIDToTypeID( "Fl  " );
        var idFl = charIDToTypeID( "Fl  " );
        var idWht = charIDToTypeID( "Wht " );
        desc5.putEnumerated( idFl, idFl, idWht );
        var idDpth = charIDToTypeID( "Dpth" );
        desc5.putInteger( idDpth, 8 );
        var idprofile = stringIDToTypeID( "profile" );
        desc5.putString( idprofile, """sRGB IEC61966-2.1""" );
        var idGdes = charIDToTypeID( "Gdes" );
            var list1 = new ActionList();
        desc5.putList( idGdes, list1 );
    var idDcmn = charIDToTypeID( "Dcmn" );
    desc4.putObject( idNw, idDcmn, desc5 );
    var idDocI = charIDToTypeID( "DocI" );
    desc4.putInteger( idDocI, 195 );
executeAction( idMk, desc4, DialogModes.NO );


To this:

Code: Select all

make();
function make() {
    var s2t = function (s) {
        return app.stringIDToTypeID(s);
    };

    var descriptor = new ActionDescriptor();
    var descriptor2 = new ActionDescriptor();
    var list = new ActionList();

    descriptor2.putBoolean( s2t( "artboard" ), false );
    descriptor2.putClass( s2t( "mode" ), s2t( "RGBColorMode" ));
    descriptor2.putUnitDouble( s2t( "width" ), s2t( "#Rlt" ), 1000.000000 );
    descriptor2.putUnitDouble( s2t( "height" ), s2t( "#Rlt" ), 1000.000000 );
    descriptor2.putUnitDouble( s2t( "resolution" ), s2t( "#Rsl" ), 72.000000 );
    descriptor2.putDouble( s2t( "pixelScaleFactor" ), 1.000000 );
    descriptor2.putEnumerated( s2t( "fill" ), s2t( "fill" ), s2t( "white" ));
    descriptor2.putInteger( s2t( "depth" ), 8 );
    descriptor2.putString( s2t( "profile" ), "sRGB IEC61966-2.1" );
    descriptor2.putList( s2t( "guides" ), list );
    descriptor.putObject( s2t( "new" ), s2t( "document" ), descriptor2 );
    descriptor.putInteger( s2t( "documentID" ), 195 );
    executeAction( s2t( "make" ), descriptor, DialogModes.NO );
}


Developed by Tomas Šinkūnas
www.rendertom.com

Released as open-source under the MIT license



Return to “Photoshop Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest