Finder: Desktop Icon Position (and Window Position)

(Requires Mac OS X v10.4)

Save the current position of desktop icons so they can be repositioned later:

property theList : missing value

tell application "Finder"
	activate
	
	if theList is not missing value then
		display dialog "Desktop icon positions." buttons {"Save", "Cancel", "Reapply"} default button 3
	else
		display dialog "Desktop icon positions." buttons {"Save"} default button 1
	end if
	
	if (button returned of result) is "Reapply" then
		repeat with i from 1 to (count (first item of theList))
			try
				set desktop position of item (item i of first item of theList) of desktop to (item i of second item of theList)
			end try
		end repeat
	else
		set theList to {name, desktop position} of items of desktop
	end if
	
	beep
end tell

Save as an application or run from the script menu.

Very nice, I use this sort of thing at work, to keep folders we use for work flow in the same place.
Also use a script to do the same for open windows. All in os9,

We are moving over to 10.4 and I needed to do the same there.

Your script helps in one fell sweep to map the icons. Thanks

I have also made one for finder windows.

for work I will combine the two.

property theList : missing value
property targList : {}

tell application "Finder"
	activate
	set i to ""
	if theList is not missing value then
		display dialog "Window positions." buttons {"Save", "Cancel", "Reapply"} default button 3
	else
		display dialog "Window positions." buttons {"Cancel", "Save"} default button 2
	end if
	
	if (button returned of result) is "Reapply" then
		repeat with i from 1 to (count (items of targList))
			set the_name to (item i of first item of theList) as string
			if not (exists (some Finder window whose name is the_name)) then
				get targList
				set targ to (item i of targList) as string
				open targ
			end if
		end repeat
		repeat with i from 1 to (count (first item of theList))
			try
				set bounds of window (item i of first item of theList) to (item i of second item of theList)
				
				set current view of window (item i of first item of theList) to (item i of third item of theList)
				
			end try
		end repeat
	else
		set theList to {name, bounds, current view} of Finder windows
		repeat with i from 1 to (count of Finder windows)
			copy target of Finder window i to end of targList
			
		end repeat
	end if
	
end tell