Copy link to clipboard
Copied
Hello gang!
I just wanted to share with you my small utility tool for Photoshop called Clean SL that cleans ScriptingListenerJS.log file to make it more readable.
Recently watched Davide_Barranca's Adobe Photoshop HTML Panels Development course and realised how painful it is to work with Action Manager's code and how unreadable it is right off the box. I know there are quite a few other tools that cleans log file, however it doesn't hurt to have an option to choose.
Interested? Grab it here: rendertom / Clean SL / source / — Bitbucket
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 for better readability and such. Resulting code is clean and maintains better readability.
From this:
var idHStr = charIDToTypeID( "HStr" );
var desc21 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindCustom = stringIDToTypeID( "presetKindCustom" );
desc21.putEnumerated( idpresetKind, idpresetKindType, idpresetKindCustom );
var idClrz = charIDToTypeID( "Clrz" );
desc21.putBoolean( idClrz, false );
var idAdjs = charIDToTypeID( "Adjs" );
var list1 = new ActionList();
var desc22 = new ActionDescriptor();
var idH = charIDToTypeID( "H " );
desc22.putInteger( idH, 39 );
var idStrt = charIDToTypeID( "Strt" );
desc22.putInteger( idStrt, 23 );
var idLght = charIDToTypeID( "Lght" );
desc22.putInteger( idLght, -27 );
var idHsttwo = charIDToTypeID( "Hst2" );
list1.putObject( idHsttwo, desc22 );
desc21.putList( idAdjs, list1 );
executeAction( idHStr, desc21, DialogModes.NO );
to this:
hueSaturation();
function hueSaturation() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var list = new ActionList();
var descriptor2 = new ActionDescriptor();
descriptor.putEnumerated( s2t( "presetKind" ), s2t( "presetKindType" ), s2t( "presetKindCustom" ));
descriptor.putBoolean( s2t( "colorize" ), false );
descriptor2.putInteger( s2t( "hue" ), 39 );
descriptor2.putInteger( s2t( "saturation" ), 23 );
descriptor2.putInteger( s2t( "lightness" ), -27 );
list.putObject( s2t( "hueSatAdjustmentV2" ), descriptor2 );
descriptor.putList( s2t( "adjustment" ), list );
executeAction( s2t( "hueSaturation" ), descriptor, DialogModes.NO );
}
Clone or download repository and place Clean SJ.jsx script to Photoshop’s Scripts folder:
Adobe Photoshop CC 20XX -> Presets -> Scripts -> Clean JS.jsx
Restart Photoshop to access Clean JS script from File -> Scripts
------------------------------------------------
Since I am rather new to Photoshop Scripting, I might have missed something of my code brakes. So if you find any bugs or issues, please do not hesitate to let me know so I could fix it.
So, happy cleaning everybody!
Copy link to clipboard
Copied
Oh wow, I totally missed the chat. Sorry for a long pause guys, I didn't visit PS forums for quite some time.
I am not sure why Puppet Warp didn't work for you guys - I did a quick test and it performed as expected on my end (PS CC2018)
Regarding XML strings, ehhh, welll, ammm, ... yeahh, maybe not. Don't really feel like messing with it anytime soon.
By the way, I just pushed small update to github that adds option to extract parameter values; Might be useful in some cases and total overkill in other cases GitHub - rendertom/Clean-SL: Clean SL is a utility tool for Adobe Photoshop to clean up ScriptingLis...
Copy link to clipboard
Copied
Actually, here's a quick demo with Puppet Warp. Not trying to win any design awards, just showing that it works on my end.
Copy link to clipboard
Copied
'Puppet Warp' didn't work for me on text letters. I tried it now in newest version 1.4 and there is no problem anymore
Copy link to clipboard
Copied
I was during my nine months inactivity on this forum when another tool to convert SL code was made, after ten months earlier I wrote mine that I shared as well with this community. Later in that time I also found xbytor2 scripted his one too.
Now I've read all posts in this theard do find differences in our produtcs and fortunatelly see that all I did for myself is sufficient. The only two things I did not fix in my code (I found after very last change) were default triple quotes to be appeared as single ones, and handling XML code.
First thing I considered not needed after all, however I found when there is no content in '''''' then all next lines (starting from opening quotes) to end of ExtendScript ToolKit gets quoted appearance. What is funny all code still works with no problem. As it occurs extremaly rare, and it needs only little manual change of one triple quote set to single one I let it remain in original shape.
The second thing I considered as unnecessary for my work to fix and probably more rare than first one is XML written to SL. You can create it by using Lens Correction from Filters in Photoshop. I just downloaded your Clean SL script to see did you solve this problem, but I see that not. If you find you want that XML bug be fixed, your code will be nothing than perfect
Regarding me I am not going to update my code. I created dedicated topic on this fourm in December 2016 where I gave users chance me to change anything they want in my script. But only Jarda Bereza and JavierAroche had some wishes / advices. I changed then some things for them what I wrote in a topic the code was posted in. Seeing no more requests I considered code fits people expectations and as far as it is also good for me I did not make more changes.
As to single convertion of a code, that how that looks like comparing our outputs it seems there are slight differences, one can like more or less. I had no reports mine failed ever (at least from myself using it often), and yours too, so we can say to ourselves good job
Copy link to clipboard
Copied
Javier Aroche has his own cleaning tool 🙂
And I also have my own cleaning tool but it is playable JSON object: GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop A...
Copy link to clipboard
Copied
xbytor2 / November 2006 / xtools
Marek Omszański / December 2016 / AM Code Replacement - PS-SCRIPTS.COM
Tomas Sinkunas / September 2017 / rendertom / Clean SL / source / — Bitbucket
JavierAroche / December 2017 / GitHub - JavierAroche/parse-action-descriptor-code: Adobe's Scripting Listener Action Descriptor cod...
Jarda Bereza / December 2017 / GitHub - jardicc/ActionManagerHumanizer: This tool will reveal for you occult mystery of Photoshop A...
Copy link to clipboard
Copied
It's a splendid tool, and something that would definitely benefit from; making better sense of "code soup!"
I've successfully installed the ScriptingListener plugin, as well as your Clean SL script on my machine, and am able to bring up the window.
The Problem is, I can't seem to Load the Full log, or load the last log entry either. (blank screen.) I double-checked my desktop, and indeed the ScriptingListenerJS.log is in there. I'm running Clean ScriptingListenerJS.log v1.4 on Photoshop v 23.3.2 (newest version,) on Windows 10. Any Suggestions? Thanks.