-- Downloaded From: -- http://c-command.com/scripts/spamsieve/mailsmith-label-by-score property possibleSpamLabelIndex : 26 property spamLabelIndex : 27 property threshold : 90 on run set theList to getList() if theList is not {} then my doAction(theList) else display dialog "No messages were selected" buttons "OK" end if end run on filtermessage(m) my doAction({m}) end filtermessage on doAction(mList) tell application "Mailsmith" repeat with m in mList try set s to m's RFC822 message tell application "SpamSieve" set theScore to score message s end tell if theScore ³ 50 then set m's is_spam to true set m's is_not_spam to false if theScore > threshold then set label index of m to spamLabelIndex else set label index of m to possibleSpamLabelIndex end if else set m's is_not_spam to true set m's is_spam to false end if end try end repeat end tell end doAction on getList() tell application "Mailsmith" set retry to false try set mList to get selection as list set m to item 1 of mList if class of m is not message then set retry to true on error set retry to true end try if retry then set retry to false try set mList to message of window 1 as list on error set retry to true end try end if if retry then set mList to {} end tell return mList end getList