Skip to content

Instantly share code, notes, and snippets.

@pdxmph
Created December 5, 2011 22:55
Show Gist options
  • Save pdxmph/1435790 to your computer and use it in GitHub Desktop.
Save pdxmph/1435790 to your computer and use it in GitHub Desktop.
Compliance Filter Counts
#!/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