Commit 4033fc8c authored by Jonas Neugebauer's avatar Jonas Neugebauer

Added two mail scripts

New:
- Compse Mail
- Vacuum Index: Cleanup the mail index to speed up Mail (taken from BrettTerpstra.com)
parent c5f7eb8b
-- Subject line
property SUBJ : ""
-- Sending account to use. Needs to be in the format "Name <Mail>" and
-- exactly match the name and mail in the account settings. Leave blank to
-- use the default account.
property SENDR : ""
-- Recipients (normal, cc and bcc) for the mail. Just enter mail adresses.
property RECEIPIENTS : {""}
property CC : {}
property BCC : {}
-- an optional TextExpander snippet to set as the content
property TESNIP : ""
tell application "Mail"
set SNIP to ""
if TESNIP is not "" then
tell application "TextExpander"
set allSNIPs to (every snippet in every group whose abbreviation is TESNIP)
repeat with GRP in allSNIPs
if (count of GRP) > 0 then set SNIP to rich text expansion of first item of GRP
end repeat
end tell
end if
set newMail to make new outgoing message with properties {subject:SUBJ, sender:SENDR, content:SNIP, visible:true}
repeat with R in RECEIPIENTS
make new to recipient at end of newMail's to recipients with properties {name:"", address:R}
end repeat
repeat with C in CC
make new cc recipient at end of newMail's cc recipients with properties {name:"", address:C}
end repeat
repeat with B in BCC
make new bcc recipient at end of newMail's bcc recipients with properties {name:"", address:B}
end repeat
activate
end tell
\ No newline at end of file
(*
Speed up Mail.app by vacuuming the Envelope Index
Code from: http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/
Originally by "pmbuko" with modifications by Romulo
Updated by Brett Terpstra 2012
Updated by Mathias Trnblom 2015 to support V3 in El Capitan and still keep backwards compability
*)
tell application "Mail" to quit
set os_version to do shell script "sw_vers -productVersion"
set mail_version to "V2"
considering numeric strings
if "10.10" os_version then set mail_version to "V3"
end considering
set sizeBefore to do shell script "ls -lnah ~/Library/Mail/" & mail_version & "/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"
do shell script "/usr/bin/sqlite3 ~/Library/Mail/" & mail_version & "/MailData/Envelope\\ Index vacuum"
set sizeAfter to do shell script "ls -lnah ~/Library/Mail/" & mail_version & "/MailData | grep -E 'Envelope Index$' | awk {'print $5'}"
display dialog ("Mail index before: " & sizeBefore & return & "Mail index after: " & sizeAfter & return & return & "Enjoy the new speed!")
tell application "Mail" to activate
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment