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


Click here to return to the 'A tighter script' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A tighter script
Authored by: djr on Nov 10, '06 04:51:51PM

This is a folder action script, watching my download folder; does the same thing, but more elegantly!

on adding folder items to this_folder after receiving these_items
  set filters to {
    {"_To Install", {".smi", ".dmg", ".img", ".pkg", "Installer", "Updater"}},
    {"_Videos", {".mpg", ".wmv", ".rm", ".rmvb", ".avi", ".mov"}},
    {"_Bittorrent", {".torrent"}}
      }
  tell application "Finder"
    repeat with added_file in these_items
      repeat with destinations from 1 to (count of items in filters)
        repeat with strings_to_match from 1 to (count of items in item 2 of item destinations in filters)
          if name of added_file contains (item strings_to_match of item 2 of item destinations of filters) then
            move added_file to folder (item 1 of item destinations of filters) of this_folder
            exit repeat
          end if
        end repeat
      end repeat
    end repeat
  end tell
end adding folder items to



[ Reply to This | # ]