Thanks again for the constant help guys. I will try again. Does it matter that all the images that I am using are pngs possible causing that script to freeze up? I will try and explain again simply what I am trying to do (if that helps at all).
1. I have a bunch of pngs with a transparent background in a folder.
2. My first action is to Select Image > Trim and take the top left pixel colour. This is what we have been doing to crop the images.
3. My next action which is causing this discussion is to match the highest dimension whether it be the height or width.
4. Save the resulting image in a new folder and move on to the next.
Sorry again if I am not giving the best of details. I am fairly new with photoshop and am working on a massive overhaul of images in a catalogue.
Everything is much appreciated.
It should work with pngs. So according to your last post, it looks like you're trimming rather than "cropping." So you don't actually want to crop into the image. Then you want the image to be a 1:1 aspect ratio, so that would mean increasing the canvas size, rather than resizing the image to the longest dimension. Is that right? If so, try this script. All is does is resize the canvas.
#target photoshop
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var lSide = parseInt(Math.max(doc.width,doc.height));
canSize ();
function canSize (){
var idCnvS = charIDToTypeID( "CnvS" );
var desc11 = new ActionDescriptor();
var idWdth = charIDToTypeID( "Wdth" );
var idPxl = charIDToTypeID( "#Pxl" );
desc11.putUnitDouble( idWdth, idPxl, lSide );
var idHght = charIDToTypeID( "Hght" );
var idPxl = charIDToTypeID( "#Pxl" );
desc11.putUnitDouble( idHght, idPxl, lSide );
var idHrzn = charIDToTypeID( "Hrzn" );
var idHrzL = charIDToTypeID( "HrzL" );
var idCntr = charIDToTypeID( "Cntr" );
desc11.putEnumerated( idHrzn, idHrzL, idCntr );
var idVrtc = charIDToTypeID( "Vrtc" );
var idVrtL = charIDToTypeID( "VrtL" );
var idCntr = charIDToTypeID( "Cntr" );
desc11.putEnumerated( idVrtc, idVrtL, idCntr );
executeAction( idCnvS, desc11, DialogModes.NO );
}