Change Finder icon size on Mac OS 10.7 via AppleScript

For some time I have been amazed by the ability (or inability, depends on your taste) of Finder to keep icon views organised. Since I normally work on my windows as columns, it was never a problem to me. But changing icon sizes (or deleting files) can make a window very messy to work with, mainly because of all the scrolling it can create.

“It is very easy to have a window reorganised though”, one may say. But what happens to users who are mouse-friends and want a quick access to settings?

So I decided to code a little AppleScript to deal with that. In there, I just call a Finder window, change the folder to icon view and increase/decrease the icon size, then reorder by name. Code as follows to increase icon size:

tell application "Finder"
	activate
	set current view of window 1 to icon view
	set currentSize to (icon size of icon view options of window 1) + 32
	if (currentSize is greater than 512) then
		set currentSize to 512
	end if
	set icon size of icon view options of window 1 to currentSize
	tell window 1
		clean up by name
	end tell
end tell

To decrease, just replace the currentSize (lines 4-7) for the lines below

	set currentSize to (icon size of icon view options of window 1) - 32
	if (currentSize is less than 16) then
		set currentSize to 16
	end if

I think it would work with shortcut applications such as FastScripts, but I haven’t tested. I made an Automator application — one to increase and a separate one to decrease — and added each to my Finder toolbar, so I can change icon sizes and have the window organised by name with just one click. It works well so far on 10.7 and even on 10.6, but I’m quite sure it won’t work on the desktop since the desktop is a sort of special window, but feel free to give it a try.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>