skip to Main Content

Is there any way to run Photoshop CS5’s “auto color” function (Image->Auto Color, shift+ctrl+B) from a script written in Javascript? Looking at the “Adobe Photoshop CS5 Javascript Scripting Reference”, I see autoLevels() and autoContrast(), but no autoColor(). I tried calling autoColor() anyway in the hope it might have just been accidentally omitted from the documentation, but no luck. 🙁

If there’s no function to call directly from a script, does the Photoshop scripting API have some way to simulate pressing shift+ctrl+B (to fire off something that exists in a menu, but doesn’t support directly calling from a script)?

If there’s no direct access to something like ActiveLayer.autoColor(), and no way to kludge a simulated keystroke to fire off a function, can you at least have a script that’s iterating through multiple files load one, do everything that can be automated, pause so I can press shiftctrlB to do the auto-color, then resume execution of the script to save it as a JPEG & close the original .dng file?

2

Answers


  1. Try this:

    var idLvls = charIDToTypeID( "Lvls" );
        var desc = new ActionDescriptor();
        var idautoBlackWhite = stringIDToTypeID( "autoBlackWhite" );
        desc.putBoolean( idautoBlackWhite, true );
        var idautoNeutrals = stringIDToTypeID( "autoNeutrals" );
        desc.putBoolean( idautoNeutrals, true );
    executeAction( idLvls, desc, DialogModes.NO );
    
    Login or Signup to reply.
  2. You can always add custom (not available in api) steps to a script by creating an action in the actions pallet then running it from within the script:

    doAction("action name", "action set");
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search