A script to open PopFile from Mail.app

Dec 19, '03 11:53:00AM

Contributed by: tauzell

If you use the PopFile application for mail filtering, you can use this script from within Mail to open up the current message in PopFile. This is handy for changing the classification of the message.

To use, you first need to turn X-POPFile-Link Header to On in the Configuration area of Popfile. Then install the below script into your ~Library/Scripts/Mail folder.


using terms from application "Mail"
  on perform mail action with messages incomingMessages
  set logString to "" & return
          
  tell application "Mail"
    repeat with msg in incomingMessages
      set popFileLink to (content of header ¬
       "x-popfile-link" of msg)
      set popFileLink to (characters 2 through ¬
       ((count of popFileLink) - 1) of popFileLink)
      log "PopFile: " & popFileLink
      tell application "Safari" to open location ¬
       (popFileLink as string)
    end repeat
  end tell
              
  end perform mail action with messages
 
  on run
    tell application "Mail" to set sel to selection
    tell me to perform mail action with messages sel
  end run
end using terms from
[robg adds: I haven't tested this one...]

Comments (5)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031212152137164