Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
#target photoshop
if(findCurrentTool() == 'cropTool'){
SelectCropPreset("Crop 4 inch x 6 inch 300 ppi");
}else{
alert("You need to have the Crop Tool selected");
}
function SelectCropPreset(Preset) {
var desc5 = new ActionDescriptor();
var ref2 = new ActionReference();
ref2.putName( app.stringIDToTypeID('toolPreset'), Preset );
desc5.putReference( app.charIDToTypeID('null'), ref2 );
executeAction( app.charIDToTypeID('slct'), desc5, DialogModes.NO );
};
function findCurrentTool(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
var cTool = typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID('tool')));
return cTool;
};
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
selectTool('cropTool');
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 );
};