skip to Main Content

I use some photoshop scripts for my work, and all the time try to found a way to repeat previous curves adjusting, since many times it is necessary to repeat a similar (but not the same, so that I can slightly correct it) correction for the same type of images.

Many peoples do not know about this nuance, but in Photoshop there is a not-so-documented option to open an adjustment dialog ( levels / curves / hue saturation, etc. ) with the same values ​​aswhich they were applied the previous time. It can be done with adding ALT to the hot keys of their call.
e.g.:

CTRL+ALT+L for Levels
CTRL+ALT+M for Curves
CTRL+ALT+U for Hue/Saturation

If you dont know this, for understand what i need, try it in photoshop step by step:

  1. Open the image
  2. Press CTRL+M, edit curves points and press OK.
  3. Now press CTRL+ALT+M (you will see that a new curves dialog has opened with the same points and their positions that you applied in step 2).
  4. Change somehow curves points and click OK
  5. Now press CTRL+ALT+M again and now you will see the curves settings that were applied in step 4
  6. …and so on

I have no problem with opening any saved curves preset with scripting… however, using the presets is too limited, because picking them up for the current type of images, takes longer than changing the settings myself. I need a script where the curves would open exactly with the previous values. Just like it is done in Photoshop with CTRL+ALT+M.

If I record action (with pressing CTRL+ALT+M), the current values of the curves is simply recorded and not a repetition of the previous one.

So it possible to do this with jsx?

Many thanks!

While curves dialog create in script, this piece of code appears:

    var idpresetKind = stringIDToTypeID( "presetKind" );
    var idpresetKindType = stringIDToTypeID( "presetKindType" );
    var idpresetKindCustom = stringIDToTypeID( "presetKindUserDefined" );

Perhaps somewhere in the bowels of the Photoshop libraries there is a "preset" that repeats the previous apply values?

2

Answers


  1. Chosen as BEST ANSWER

    Thanks to @Ghoul Fool and Kukurykus from Adobe community, i found correct answear. And for somebody who will search the same thing, I`ll keep here this:

    try{dsc = getCustomOptions('curves')}catch(err){dsc = new ActionDescriptor()}
    try{dsc = executeAction(stringIDToTypeID('curves'), dsc, DialogModes.ALL),
    putCustomOptions('curves', dsc, false)}catch(err){}
    

    Save it as 'Curves.jsx' to your 'Presets / Scripts' folder of your Ps. (Re)launch app and instead of current Curves item in your action, from expandable contextual menu 'Insert Menu Item' and choose 'File > Scripts > Curves'.

    Now any time you play the action and set curves it will remember last used settings to play them back.

    src

    Thats all!


  2. If I understand you correctly, you can load an existing .acv file and then aplly the curves to it.

    var myCurves = "D:\temp\myCurvesFile.acv"; // change to your file
    
    curves(myCurves); // invoke function
    
    
    function curves(afile)
    {
        // =======================================================
        var idCrvs = charIDToTypeID( "Crvs" );
        var desc14 = new ActionDescriptor();
        var idpresetKind = stringIDToTypeID( "presetKind" );
        var idpresetKindType = stringIDToTypeID( "presetKindType" );
        var idpresetKindUserDefined = stringIDToTypeID( "presetKindUserDefined" );
        desc14.putEnumerated( idpresetKind, idpresetKindType, idpresetKindUserDefined );
        var idUsng = charIDToTypeID( "Usng" );
        desc14.putPath( idUsng, new File( afile ) );
        executeAction( idCrvs, desc14, DialogModes.NO );
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search