spammy.sikuli

(Download this script)
import sys

if len(sys.argv) > 1 and sys.argv[1][0].lower() == 't':
    filter = 'from:(googlealerts-noreply@google.com'
else:
    filter = 'from:(jetbluepromotions.com'

def firefoxFind(targetText):
    # Moves the focus to the targetText - 
    # sometimes the most efficient way to 
    # bring it on-screen
    type("f", KEY_CTRL)
    type(targetText)

def clickEditFollowingText(targetText):
    firefoxFind(targetText)
    firefoxFind("edit")
    # hit Escape to lose green-color focus
    type(Key.ESC)
    click()

setAutoWaitTimeout(15) # slow web connection here!

switchApp('firefox')

# "Filter messages like these" is fifth in the
# "More actions" dropdown.  Accessing it by
# typing is easier than screen captures for
# dropdown and pop-up menus.
click()
type(Key.DOWN * 5)
type(Key.ENTER)

wait()
# Cursor comes up in the "from: " field; copy from it
# into clipboard to get sender's address
type("a", KEY_CTRL)
type("c", KEY_CTRL)
sender = Env.getClipboard()

click()
wait()

clickEditFollowingText(filter)

type("  || " + sender)
click()
wait()
firefoxFind("Show current filters")
click(Pattern().targetOffset(-63,3))
click()