Created
December 5, 2011 22:55
-
-
Save pdxmph/1435790 to your computer and use it in GitHub Desktop.
Compliance Filter Counts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby -wKU | |
require "rubygems" | |
require "appscript" | |
include Appscript | |
mail = app("Mail") | |
account = mail.accounts["Social Media Today"].get | |
inbox = account.mailboxes["INBOX"].get | |
messages = inbox.messages[its.subject.eq("Post Flagged: Client Compliance Match")].get | |
hits = Hash.new(0) | |
messages.each do |m| | |
m.content.get.each_line do |l| | |
if l.match(/^\- /) | |
word = l.gsub(/^-/,"").strip! | |
hits[word] += 1 | |
end | |
end | |
end | |
hits.each do |k,v| | |
puts "#{k}: #{v}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment