Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Why not use folder actions to organize too?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why not use folder actions to organize too?
Authored by: infoblink on Oct 30, '03 05:01:32PM

on adding folder items to this_folder after receiving added_items
	tell application "Finder"
		set folderLocation to (container of (path to desktop folder) as string) & "Pictures:unfiled:"
		
		repeat with aFile in added_items
			if the name of aFile contains {".jpg"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:JPG:"
			else if the name of aFile contains {".png"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:PNG:"
			else if the name of aFile contains {".pict"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:PICT:"
			else if the name of aFile contains {".tiff"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:TIFF:"
			else if the name of aFile contains {".gif"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:GIF:"
			else if the name of aFile contains {".psd"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:PSD:"
			else if the name of aFile contains {".bmp"} then
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:BMP:"
			else
				set folderLocation to (container of (path to desktop folder) as string) & "Pictures:unfiled:"
			end if
			tell application "Finder"
				try
					
					move aFile to folder folderLocation
					
				on error err
					display dialog err
				end try
			end tell
			display dialog ¬
				"Image files have been moved to the Unfiled folder in your Pictures folder."
		end repeat
	end tell
end adding folder items to
That organizes the files too.

[ Reply to This | # ]