Photoshop Batch Canvas Resize to Square - 17000 images

Hi guys, long time reader but first time poster and am in need of help working out an applescript to batch resize the canvas of over 17,000 images.

The script I have is …

repeat
	tell application "Adobe Photoshop CS5"
		activate
		set thisdoc to current document
		set docHeight to height of thisdoc
		set docWidth to width of thisdoc
		set display dialogs to never
		tell thisdoc
			if docHeight > docWidth then
				resize canvas width docHeight anchor position middle center
			else
				resize canvas height docWidth anchor position middle center
			end if
			
			save
			close
		end tell
	end tell

However, this only works on open files within Photoshop. And my poor machine won’t let me do any more than 80 at a time … is there a way this could be tweaked so it resizes all images to a square canvas based on the longest edge?

Thanks in advance!

Hi keeno79,

you’re post is in the wrong forum.
This should not happen to a “long time reader” :wink:

Hans

set theFolder to (choose folder) as text
set theList to list folder theFolder without invisibles

repeat with theItem from 1 to count of theList
    set PicName to item theItem of theList
    set PicPath to theFolder & PicName
    tell application "Adobe Photoshop CS5"
        activate
        try
            open file PicPath
            set thisdoc to current document
            set docHeight to height of thisdoc
            set docWidth to width of thisdoc
            set display dialogs to never
            tell thisdoc
                if docHeight > docWidth then
                    resize canvas width docHeight anchor position middle center
                else
                    resize canvas height docWidth anchor position middle center
                end if
                
                save
                close
            end tell
        end try
    end tell
    
end repeat