Possible to record action adding new layer (e.g. B&W) using "auto" settings?

Participant ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

I am frequently recording actions, but have not (yet) learned to write scripts. Is is possible to make the adjustments to "auto" when adding e.g. a B&W layer in a recorded action?

TOPICS
Actions and scripting , Windows

Views

61

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 07, 2022 Jun 07, 2022
s2t = stringIDToTypeID; (r = new ActionReference()).putEnumerated(s2t("adjustmentLayer"), s2t("ordinal"), s2t("targetEnum")); (d = new ActionDescriptor()).putReference(s2t("target"), r); (d1 = new ActionDescriptor()).putEnumerated(s2t("presetKind"), s2t("presetKindType"), s2t("presetKindCustom")); d1.putBoolean(s2t("auto"), true); d.putObject(s2t("to"), s2t("blackAndWhite"), d1); executeAction(s2t("set"), d, DialogModes.NO); Save this code to a text file, change the file extension to .jsx, ...

Likes

Translate

Translate
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

 

s2t = stringIDToTypeID;

(r = new ActionReference()).putEnumerated(s2t("adjustmentLayer"), s2t("ordinal"), s2t("targetEnum"));
(d = new ActionDescriptor()).putReference(s2t("target"), r);
(d1 = new ActionDescriptor()).putEnumerated(s2t("presetKind"), s2t("presetKindType"), s2t("presetKindCustom"));
d1.putBoolean(s2t("auto"), true);
d.putObject(s2t("to"), s2t("blackAndWhite"), d1);
executeAction(s2t("set"), d, DialogModes.NO);

 

Save this code to a text file, change the file extension to .jsx, place the file in the Photoshop presets directory (Adobe Photoshop 2022\Presets\Scripts). After restarting Photoshop you will see this script in File->Scripts menu

 

Select the Black&White adjustment layer and then run the script. It will apply auto-values. If necessary, the script call can be written into an action.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Fantastic! Many thanks, this has solved a task which has slowed me down for a long time.
Is there a similar smooth way of doin the same but for a "levels" layer?

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

2022-06-07_17-18-31.png

 

s2t = stringIDToTypeID;
(r = new ActionReference()).putEnumerated(s2t("adjustmentLayer"), s2t("ordinal"), s2t("targetEnum"));
(d = new ActionDescriptor()).putReference(s2t("target"), r);
(r1 = new ActionReference()).putEnumerated(s2t("channel"), s2t("channel"), s2t("composite"));
(d1 = new ActionDescriptor()).putReference(s2t("channel"), r1);

//enhance monochromatic conrast
//d1.putBoolean( s2t( "autoContrast" ), true );

//enhance per channel contrast
//d1.putBoolean( s2t( "auto" ), true );

//find dark and light colors
// d1.putBoolean( s2t( "autoBlackWhite" ), true );

//default: enhance brightness and contrast
d1.putBoolean(s2t("autoMachineLearning"), true);
d1.putBoolean(s2t("autoFaces"), true);
//

(l = new ActionList()).putObject(s2t("levelsAdjustment"), d1);
(d2 = new ActionDescriptor()).putList(s2t("adjustment"), l);
d.putObject(s2t("to"), s2t("levels"), d2);
executeAction(s2t("set"), d, DialogModes.NO);

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Many thanks!!!!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

@jazz-y excellent work, when it wasn't recorded in an action or script listener log my only hope was for someone with advanced AM code knowledge to step up!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

Actually the scriptListener shows it. Not for an adjustment layer, but for a regular tool window. I just took the settings from there and copied them to an adjustment layer 😉

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 07, 2022 Jun 07, 2022

Copy link to clipboard

Copied

LATEST

That is gold!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines