Hi JJ,
Thank you very much for the effort you put in trying to find an answer to my question, but I'm afraid this is not what I'm looking for.
There's no time for rotating and transforming selection boxes in my workflow: there's nothing creative in it, you just have to choose which side to crop the images from (left/right and top/bottom, respectively). It's a very straightforward process, but the fact that I have to continually click the "Swap" button is annoying (we're talking about thousands of images).
I just need Photoshop to realize that the current image has a different orientation than the previous one and automatically "Swap Height and Width" for the Crop tool.
Have a great weekend,
Ed
Here is an script event manager script that will choose the crop tool preset depending on orientation. You will need to edit the tool preset names to match what is on your system.
function _selectDocumentHandler(desc) {
var currentTool = getCurrentTool();
if( currentTool == 'cropTool' ){
var defaultRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var w = doc.width;
var h = doc.height;
if( w>h ){
selectPreset('Crop Tool 8 in x 6 in');
}else{
selectPreset('Crop Tool 6 in x 8 in');
}
app.preferences.rulerUnits = defaultRulerUnits;
}
};
function getCurrentTool(){
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
return typeIDToStringID(executeActionGet(ref).getEnumerationType(stringIDToTypeID('tool')));
};
function selectPreset(setName){
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putName( stringIDToTypeID( "toolPreset" ), setName );
desc.putReference( charIDToTypeID( "null" ), ref );
executeAction( charIDToTypeID( "slct" ), desc, DialogModes.NO );
};
try {
if (arguments.length >= 2) {
var desc = arguments[0];
var event = arguments[1];
if (event == charIDToTypeID('slct')) {
var ref = desc.getReference(charIDToTypeID('null'));
var cls = ref.getDesiredClass();
if (cls == charIDToTypeID('Dcmn')) {
_selectDocumentHandler(desc);
}
}
}
} catch (e) {
alert( "Error: " + e + ":" + e.line );
}