Auto Color, shift+ctrl+B) from a script written in Javascript? Looking at the "A..." /> Auto Color, shift+ctrl+B) from a script written in Javascript? Looking at the "A..." /> Auto Color, shift+ctrl+B) from a script written in Javascript? Looking at the "A..."/>

Call Photoshop CS5's "auto color" (shift+ctrl+B) from script?

394 Views Asked by At

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 shift-ctrl-B to do the auto-color, then resume execution of the script to save it as a JPEG & close the original .dng file?

2

There are 2 best solutions below

0
On

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 );
0
On

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