This works. I just made it. I’m using it now. Just thought I’d share.
I had folders on my desktop. I wanted to change the icon if they were full the way the trashcan icon changes when it’s full. So, I made some icons and made this script. It would be easy enough to make badges that show the number of items in a folder by modifying this script. I just didn’t want to draw and save a million icons.
takes some configuring
- download osxutils http://sourceforge.net/projects/osxutils
- decompressing that file might be tricky. I had to use EZ 7z.app
- install that pkg
- make one icon for the folder when it’s empty, make one icon for the folder when it’s full (has 1 or more items in it)
– eg: if the folder name is “Skydiving” you should name the icons “Skydiving_empty.icns” and “Skydiving_full.icns”
– I’m using the icons I made to go with kinkless desktop http://jugglegood.com/outside/kinkless_desktop/ - save the below script in your folder actions folder
- change the first line to mesh with your actual directory where you’re keeping the icon files
- open Applescript Utility
- click folder actions
- select the folder that you want to change in the first column
- select the script that you just saved in the second column
I think that will work. let me know if you have any problems, or if you like it. I know I’m not very efficient in coding. feel free to streamline and repost.
property icons_folder : "/Users/scot/Pictures/kinkless_icons/"
on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
set folder_list to list folder this_folder without invisibles
set folder_count to number of items in folder_list
set folder_status to "full"
if folder_count is 0 then
set folder_status to "empty"
end if
set icon_path to the quoted form of POSIX path of (icons_folder & folder_name & "_" & folder_status & ".icns")
set folder_path to the quoted form of POSIX path of this_folder
do shell script "/usr/local/bin/seticon " & icon_path & " " & folder_path
tell application "Finder" to update (container of this_folder)
end try
end adding folder items to
on removing folder items from this_folder
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
set folder_list to list folder this_folder without invisibles
set folder_count to number of items in folder_list
set folder_status to "full"
if folder_count is 0 then
set folder_status to "empty"
end if
set icon_path to the quoted form of POSIX path of (icons_folder & folder_name & "_" & folder_status & ".icns")
set folder_path to the quoted form of POSIX path of this_folder
do shell script "/usr/local/bin/seticon " & icon_path & " " & folder_path
tell application "Finder" to update (container of this_folder)
end try
end removing folder items from