[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Killing vcards



This might be an appropriate time to mention that I've been playing 
around with 8.5's Folder Actions.  (I'm on a number of other mailing 
lists related to SSL and TLS standardization issues and receive a 
mindboggling number of these "Kick Me" attachments.)

I set up the following applescript as a Folder Action on my attachments 
directory.  With the Folder Actions extension and the Folder Action Menus 
contextual menu plugin installed, "Attach a Folder Action..." is available 
as a contextual menu option.  

__BEGIN__

on adding folder items to this_folder after receiving added_items
  tell application "Finder"
    repeat with i from 1 to the number of items in the added_items
      set this_item to (item i of the added_items)

      if my check_icky_name(this_item) is true then
        move this_item to the trash
      end if
    end repeat
  end tell
end adding folder items to


on check_icky_name(this_item)
  set this_name to this_item as text
  if this_name contains ".vcf" then
    set the check_flag to true
  else if this_name contains "smime.p7s" then
    set the check_flag to true
  else
    set the check_flag to false
  end if
end check_icky_name

__END__

The only caveat is that, for the action to work, the folder must actually 
be open in the finder.  Fortunately, a tabbed window counts as being open 
for these purposes.  So far, it works like a charm.

I used to have problems receiving WINMAIL.DAT files as well, but haven't 
seen any in quite a while.  So for now, I'm just getting rid of vcards 
and smime attachments.


-Charles Albrecht
 <albrecht@gate.net>
 <http://www.gate.net/~albrecht/cv/>



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch