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
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"),
...
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?
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.
Copy link to clipboard
Copied
Just create a preset for the tool.
Copy link to clipboard
Copied
I know, but I need script for other project. 🙂
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.
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 );
};
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 );
}
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'
*/
Copy link to clipboard
Copied
Hi Stephen,
Thanks for your help!
I hope there is a way to setting option for them.
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
Copy link to clipboard
Copied
Yes, Maybe someone will continue write it 🙂
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);
Copy link to clipboard
Copied
Thank you so much!
The great! This is what I need.
Have a nice day!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
i also learned from r-bin's sample,such as https://community.adobe.com/t5/photoshop/how-to-set-the-customshapetool-s-shape-name/m-p/10549976#M2...
Copy link to clipboard
Copied
Thank you!
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I resolved it. 🙂
Copy link to clipboard
Copied
Very interesting this
You can do it with spongeTool for me it would be very useful.
Copy link to clipboard
Copied
This question can now be found here:
https://community.adobe.com/t5/photoshop/change-spongetool-values/m-p/10787023#M288850
Copy link to clipboard
Copied
Hi guy,
Could you please guide me one thing, I want add size of tool in this script.
Thanks!