• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Script call dodge & burn

Participant ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Hello all,

 

Please help me write a script.

 

I want call the dodge & burn tool with setup:

1. Dodge: Range: Highlight, Exposure: 100%

2. Burn: Range: Shadow, Exposure: 100%

 

Any help would be appreciated.

 

Thank in advance!

Annc

TOPICS
Actions and scripting

Views

2.7K

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

Engaged , Dec 03, 2019 Dec 03, 2019

dodgeTool:

var r = new ActionReference();   
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));   
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));   
  
var options = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));             
  
 
options.putEnumerated(stringIDToTypeID("mode"),stringIDToTypeID("blendMode"),stringIDToTypeID("dodgeH"));   
options.putInteger(stringIDToTypeID("exposure"),
...

Votes

Translate

Translate
Adobe
Community Expert ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Have you some design for how the script will function  dodge and burn are normally interactive  processes.

 

Dodge: Range: Highlight, Exposure: 100%;  Burn: Range: Shadow, Exposure: 100% ???

Have you written a prototype script?

JJMack

Votes

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 ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Hello JJMack,

 

I just want simple:

 

Example case 1: current tool is Brush, I will run script -> current tool is Dodge with setup above.

Votes

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
Community Expert ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Just create a preset for the tool.

Votes

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 ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

I know, but I need script for other project. 🙂

Votes

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
Community Expert ,
Dec 02, 2019 Dec 02, 2019

Copy link to clipboard

Copied

Raw AM code via ScriptListener for Dodge:

 

var idslct = charIDToTypeID( "slct" );
    var desc561 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref203 = new ActionReference();
        var idDdTl = charIDToTypeID( "DdTl" );
        ref203.putClass( idDdTl );
    desc561.putReference( idnull, ref203 );
executeAction( idslct, desc561, DialogModes.NO );

 

Change "DdTl" to "BrTl" for Burn – and idDdTl to idBrTl for Burn.

 

AM code for Dodge (via Clean SL):

 

select();
function select() {
	var c2t = function (s) {
		return app.charIDToTypeID(s);
	};

	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};

	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();

	reference.putClass( s2t( "dodgeTool" ));
	descriptor.putReference( c2t( "null" ), reference );
	executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}

 

AM code for Burn (via Clean SL):

 

select();
function select() {
	var c2t = function (s) {
		return app.charIDToTypeID(s);
	};

	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};

	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();

	reference.putClass( s2t( "burnInTool" ));
	descriptor.putReference( c2t( "null" ), reference );
	executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}

 

I am not aware of an option for setting the actual tool settings, apart from calling a tool preset.

Votes

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
Community Expert ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

 

Edit: Tool list updated!

 

//www.ps-scripts.com/viewtopic.php?f=68&t=11342&p=64930&hilit=selectTool#p64930

//selectTool('paintbrushTool');
//selectTool('pencilTool');
//selectTool('colorReplacementBrushTool');
//selectTool('wetBrushTool');
//selectTool('eraserTool');
//selectTool('backgroundEraserTool');
//selectTool('cloneStampTool');
//selectTool('patternStampTool');
//selectTool('magicStampTool');
//selectTool('historyBrushTool');
//selectTool('artBrushTool');
//selectTool('smudgeTool');
//selectTool('blurTool');
//selectTool('sharpenTool');
//selectTool('dodgeTool');
//selectTool('burnInTool');
//selectTool('saturationTool');
//selectTool('redEyeTool');
//selectTool('marqueeRectTool');
//selectTool('marqueeEllipTool');
//selectTool('marqueeSingleRowTool');
//selectTool('marqueeSingleColumnTool');
//selectTool('moveTool');
//selectTool('artboardTool');
//selectTool('lassoTool');
//selectTool('magicLassoTool');
//selectTool('polySelTool');
//selectTool('magneticLassoTool');
//selectTool('magicWandTool');
//selectTool('quickSelectTool');
//selectTool('cropTool');
//selectTool('perspectiveCropTool');
//selectTool('sliceTool');
//selectTool('sliceSelectTool');
//selectTool('magicEraserTool');
//selectTool('gradientTool');
//selectTool('bucketTool');
//selectTool('pathComponentSelectTool');
//selectTool('directSelectTool');
//selectTool('penTool');
//selectTool('CATracePenTool');
//selectTool('freeformPenTool');
//selectTool('curvaturePenTool');
//selectTool('addKnotTool');
//selectTool('deleteKnotTool');
//selectTool('convertKnotTool');
//selectTool('typeCreateOrEditTool');
//selectTool('typeVerticalCreateOrEditTool');
//selectTool('typeCreateMaskTool');
//selectTool('typeVerticalCreateMaskTool');
//selectTool('rectangleTool');
//selectTool('ellipseTool');
//selectTool('triangleTool');
//selectTool('polygonTool');
//selectTool('lineTool');
//selectTool('customShapeTool');
//selectTool('framedGroupTool');
//selectTool('eyedropperTool');
//selectTool('colorSamplerTool');
//selectTool('rulerTool');
//selectTool('textAnnotTool');
//selectTool('handTool');
//selectTool('rotateTool');
//selectTool('zoomTool');
//selectTool('patchSelection');
//selectTool('recomposeSelection');
//selectTool('spotHealingBrushTool');
//selectTool('editToolbar');
//selectTool('countTool');
//selectTool('3DMaterialSelectTool');
//selectTool('3DMaterialDropTool');
//selectTool('targetedAdjustorTool');
//selectTool('eyedropper2Tool');
//selectTool('eyedropperPlusTool');
//selectTool('eyedropperMinusTool');
//selectTool('blackAndWhiteTool');
//selectTool('hueSatTool');
//selectTool('curvesTool');
//selectTool('blackPointTool');
//selectTool('grayPointTool');
//selectTool('whitePointTool');
//selectTool('selectionLabSmartBrushTool');
//selectTool('selectionLabRefineTool');
//selectTool('selectionLabDumbBrushTool');
//selectTool('selectionLabMagicLassoTool');
//selectTool('selectionLabLassoTool');
//selectTool('selectionLabPolyLassoTool');
//selectTool('patchMatchTool');
//selectTool('patchMatchSamplingBrushTool');
//selectTool('patchMatchLassoTool');
//selectTool('patchMatchPolyLassoTool');
//selectTool('patchMatchAlignmentTool');
//selectTool('patchMatchHandTool');
//selectTool('patchMatchZoomTool');
//selectTool('neuralGalleryTool');
//selectTool('neuralGalleryHandTool');
//selectTool('neuralGalleryZoomTool');
//selectTool('neuralGalleryBrushTool');
//selectTool('neuralGallerySelectionBrushTool');
//selectTool('neuralGallerySelectionRemovalBrushTool');

function selectTool(tool) {
    var desc9 = new ActionDescriptor();
        var ref7 = new ActionReference();
        ref7.putClass( app.stringIDToTypeID(tool) );
    desc9.putReference( app.charIDToTypeID('null'), ref7 );
    executeAction( app.charIDToTypeID('slct'), desc9, DialogModes.NO );
};

 

Votes

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
Community Expert ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

Select a tool preset:

 

// forums.adobe.com/thread/2641154

// Select the Rectangular Marquee Tool
// This overcomes the issue of the "current tool only" preset option being active

// forums.adobe.com/message/8785597#8785597
// forums.adobe.com/message/8786309#8786309
// www.ps-scripts.com/viewtopic.php?f=68&t=11342&p=64930&hilit=selectTool#p64930

var desc = new ActionDescriptor();   
var ref = new ActionReference();   
ref.putClass( app.stringIDToTypeID('marqueeRectTool') );   
desc.putReference( app.charIDToTypeID('null'), ref );   
executeAction( app.charIDToTypeID('slct'), desc, DialogModes.NO );

// Select the Preset: Rectangular Marquee 4 X 6
// To Do: Add error checking to return an alert if the desired preset does not exist

select();
function select() {
	var c2t = function (s) {
		return app.charIDToTypeID(s);
	};

	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};

	var descriptor = new ActionDescriptor();
	var reference = new ActionReference();

	reference.putName( s2t( "toolPreset" ), "Rectangular Marquee 4 X 6" ); // Name of Tool Preset to select
	descriptor.putReference( c2t( "null" ), reference );
	executeAction( s2t( "select" ), descriptor, DialogModes.NO );
}

Votes

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
Community Expert ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

And here from JJMack:

 

https://community.adobe.com/t5/photoshop/many-tools-cannot-be-used-in-actions/td-p/10737627

 

function selectTool(tool) {
    var desc9 = new ActionDescriptor();
        var ref7 = new ActionReference();
        ref7.putClass( app.stringIDToTypeID(tool) );
    desc9.putReference( app.charIDToTypeID('null'), ref7 );
    executeAction( app.charIDToTypeID('slct'), desc9, DialogModes.NO );
};

/*  some Photoshop tool names
'moveTool'                     'cloneStampTool'            'typeCreateOrEditTool'            'artboardTool'
'marqueeRectTool'              'patternStampTool'          'typeVerticalCreateOrEditTool'    'perspectiveCropTool'
'marqueeEllipTool'             'historyBrushTool'          'typeCreateMaskTool'              'eyedropperTool'              
'marqueeSingleRowTool'         'artBrushTool'              'typeVerticalCreateMaskTool'      '3DMaterialSelectTool'
'marqueeSingleColumnTool'      'eraserTool'                'pathComponentSelectTool'
'lassoTool'                    'backgroundEraserTool'      'directSelectTool'
'polySelTool'                  'magicEraserTool'           'rectangleTool'
'magneticLassoTool'            'gradientTool'              'roundedRectangleTool'
'quickSelectTool'              'bucketTool'                'ellipseTool'
'magicWandTool'                'blurTool'                  'polygonTool'
'cropTool'                     'sharpenTool'               'lineTool'
'sliceTool'                    'smudgeTool'                'customShapeTool'
'sliceSelectTool'              'dodgeTool'                 'textAnnotTool'
'spotHealingBrushTool'         'burnInTool'                'soundAnnotTool'
'magicStampTool'               'saturationTool'            'eyedropperTool'
'patchSelection'               'penTool'                   'colorSamplerTool'
'redEyeTool'                   'freeformPenTool'           'rulerTool'
'paintbrushTool'               'addKnotTool'               'handTool'
'pencilTool'                   'deleteKnotTool'            'zoomTool'
'colorReplacementBrushTool'    'convertKnotTool'           'wetBrushTool' 
*/

Votes

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 ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

Hi Stephen,

 

Thanks for your help!

 

I hope there is a way to setting option for them.

Votes

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
Community Expert ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

As I said at the foot of my first post:

 

I am not aware of an option for setting the actual tool settings, apart from calling a tool preset.

 

Likes

 

Votes

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 ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

Yes, Maybe someone will continue write it 🙂

Votes

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
Engaged ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

dodgeTool:

var r = new ActionReference();   
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));   
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));   
  
var options = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));             
  
 
options.putEnumerated(stringIDToTypeID("mode"),stringIDToTypeID("blendMode"),stringIDToTypeID("dodgeH"));   
options.putInteger(stringIDToTypeID("exposure"),100);  
  

var r = new ActionReference();   
r.putClass(stringIDToTypeID("dodgeTool"));   //dodgeTool    burnInTool
var d = new ActionDescriptor();   
d.putReference(stringIDToTypeID("null"), r);   
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);   
  
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);   

 

 

burnInTool:

var r = new ActionReference();   
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));   
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));   
  
var options = executeActionGet(r).getObjectValue(stringIDToTypeID("currentToolOptions"));             
  
 
options.putEnumerated(stringIDToTypeID("mode"),stringIDToTypeID("blendMode"),stringIDToTypeID("burnInS"));   
options.putInteger(stringIDToTypeID("exposure"),100);  
  

var r = new ActionReference();   
r.putClass(stringIDToTypeID("burnInTool"));   //dodgeTool    burnInTool
var d = new ActionDescriptor();   
d.putReference(stringIDToTypeID("null"), r);   
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("null"), options);   
  
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);   

 

Votes

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 ,
Dec 03, 2019 Dec 03, 2019

Copy link to clipboard

Copied

Thank you so much!

The great! This is what I need.

Have a nice day!

Votes

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
Community Expert ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

Great job 龚亮g64532194 !!!

 

Can you please share where/how you found out how to do that?

Votes

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
Engaged ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

Votes

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
Community Expert ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

Thank you!

Votes

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 ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

Hello bro 龚亮g64532194,

 

I don't know why I used it yesterday but it can't be used today 😞

 

 

Votes

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 ,
Dec 04, 2019 Dec 04, 2019

Copy link to clipboard

Copied

I resolved it. 🙂

 

Votes

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
Advocate ,
Dec 05, 2019 Dec 05, 2019

Copy link to clipboard

Copied

Very interesting this

You can do it with spongeTool for me it would be very useful.

Votes

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
Community Expert ,
Dec 07, 2019 Dec 07, 2019

Copy link to clipboard

Copied

Votes

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 ,
Mar 17, 2020 Mar 17, 2020

Copy link to clipboard

Copied

LATEST

Hi guy,

Could you please guide me one thing, I want add size of tool in this script.

Thanks!

Votes

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