Need help with Photoshop script

I have this script that goes through a folder and all subfolders to open and resave each file (they’re TIFFs) with LZW compression and with byte order for IBM PC.

I would like to have the script only resave files that are 1mb or larger instead of doing every file. I’m a real newbie with applescript so any help would be appreciated.


on run
	tell application "Finder"
		set sourcePath to choose folder with prompt "Please select SOURCE folder:"
		set savePath to choose folder with prompt "Please select DESTINATION folder:"
		set fileList to (files of entire contents of sourcePath) as alias list
	end tell
	repeat until fileList = {}
		set FilePath to item 1 of fileList as alias
		tell application "Adobe Photoshop CS3"
			open FilePath
			save document 1 in FilePath as TIFF with options {class:TIFF save options, byte order:IBM PC, image compression:LZW} appending lowercase extension
			close document 1
		end tell
		set fileList to rest of fileList
	end repeat
end run


just change

to set fileList to (files of entire contents of sourcePath whose size > 1.0E+6) as alias list

Thanks! It works great.


Just curious as to why you’re choosing those parameters: LZW and TIFF byte order.

Jim Neumann

I want to make the file sizes smaller and use lossless compression so that’s why LZW. Also these TIFF files will eventually go through a batch OCR program and for some reason it doesn’t like when the byte order is set to Mac.

That’s cool. I always have a little flag go up when I see LZW. It’s very unfriendly in many commercial printing environments.

Have a good one.