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

Script call dodge & burn

Participant ,
Dec 02, 2019 Dec 02, 2019

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
3.5K
Translate
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"),
...
Translate
Adobe
Community Expert ,
Dec 02, 2019 Dec 02, 2019

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
Translate
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

Hello JJMack,

 

I just want simple:

 

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

Translate
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

Just create a preset for the tool.

Translate
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

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

Translate
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

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.

Translate
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

 

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

 

Translate
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

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 );
}
Translate
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

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' 
*/
Translate
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

Hi Stephen,

 

Thanks for your help!

 

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

Translate
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

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

 
Translate
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

Yes, Maybe someone will continue write it 🙂

Translate
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

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

 

Translate
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

Thank you so much!

The great! This is what I need.

Have a nice day!

Translate
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

Great job é¾šäº®g64532194 !!!

 

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

Translate
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
Translate
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

Thank you!

Translate
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

Hello bro é¾šäº®g64532194,

 

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

 

 

Translate
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

I resolved it. 🙂

 

Translate
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

Very interesting this

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

Translate
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
Translate
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
LATEST

Hi guy,

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

Thanks!

Translate
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