using terms from application "Mail" on perform mail action with messages theMessages for rule theRule tell application "Mail" set numberOfMessages to count theMessages repeat with eachMessage in theMessages set theSubject to subject of eachMessage try set nameOfAttachment to the name of the first mail attachment of eachMessage if nameOfAttachment ends with ".torrent" then --edit the next line with your machine's info set filename to "Macintosh HD:Users:mattcomi:Desktop:td_" & nameOfAttachment save first mail attachment of eachMessage in filename tell application "Azureus" set torrent to open file filename open torrent end tell end if end try end repeat end tell end perform mail action with messages end using terms from