Copy link to clipboard
Copied
hi,everybody,
How do I set the content-aware move tool mode to move?
...// select tool
var r = new ActionReference();
r.putClass(stringIDToTypeID("recomposeSelection"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
// set option
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = r
Copy link to clipboard
Copied
Create a tool Preset for the content aware Move tool where mode is et to move. Then in your script Select the Conten aware Move tool to make it the current tool. Then select tool preset "content aware move tool mode move"
selectTool("recomposeSelection"); // Content Arare Move Tool
selectToolPreset("Content-Aware Move Tool Mode Move"); // Mode move
// =================================================== Helper functions ===================================================== //
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 );
};
function selectToolPreset(PresetName) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( stringIDToTypeID( "toolPreset" ), PresetName );
desc.putReference( charIDToTypeID( "null" ), ref );
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
}
Copy link to clipboard
Copied
thank you,That's one way to do it.i wanted to reset all tools but the mode of the content-aware move tool not reset,it may be a bug in photoshop. so i need other method.
Copy link to clipboard
Copied
Please report the reset bug to Adobe on their feedback site Photoshop Family Customer Community
Copy link to clipboard
Copied
// select tool
var r = new ActionReference();
r.putClass(stringIDToTypeID("recomposeSelection"));
var d = new ActionDescriptor();
d.putReference(stringIDToTypeID("null"), r);
executeAction(stringIDToTypeID("select"), d, DialogModes.NO);
// set option
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("tool"));
r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var ret = executeActionGet(r);
var options = ret.getObjectValue(stringIDToTypeID("currentToolOptions"));
var tool = ret.getEnumerationType(stringIDToTypeID("tool"));
options.putInteger(stringIDToTypeID("recomposeMode"), 2); // or 1 for move
var r = new ActionReference();
r.putClass(tool);
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
That is a much better way then requiring a tool preset. Still Reset tool should set the tools option mode to some default setting.
Copy link to clipboard
Copied
It's perfect, thank you
Find more inspiration, events, and resources on the new Adobe Community
Explore Now