<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hawk Wings &#187; automate</title>
	<atom:link href="http://www.hawkwings.net/tag/automate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.hawkwings.net</link>
	<description>Tips and add-ons to make Apple Mail / Mail.app even better</description>
	<lastBuildDate>Tue, 26 Jul 2011 07:44:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Scripts to automate the Mail.app Envelope speed trick</title>
		<link>http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/</link>
		<comments>http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/#comments</comments>
		<pubDate>Sat, 03 Mar 2007 12:35:28 +0000</pubDate>
		<dc:creator>Tim Gaden</dc:creator>
				<category><![CDATA[Apple Mail]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Apple Mail Tips]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[automate]]></category>
		<category><![CDATA[envelope]]></category>
		<category><![CDATA[iCal]]></category>
		<category><![CDATA[mail.app]]></category>
		<category><![CDATA[scripts]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/</guid>
		<description><![CDATA[Thursday&#8217;s tip about trimming the fat out of Mail&#8217;s Envelope Index for a leaner, faster Mail.app got a fair bit of coverage. Two readers liked it so much that they have produced applescripts to do the job. Sebastian Morsch has written a script that quits Mail, runs the sqlite commands and then relaunches Mail at [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.hawkwings.net/wp-content/uploads/2007/03/speedymail1.jpg" alt="Speedymail"  align="right" border="0" hspace="10" vspace="0" height="101" width="130"/>Thursday&#8217;s tip about <a href="http://www.hawkwings.net/2007/03/01/a-faster-way-to-speed-up-mailapp/">trimming the fat out of Mail&#8217;s Envelope Index</a> for a leaner, faster Mail.app got a fair bit of coverage.</p>
<p>Two readers liked it so much that they have produced applescripts to do the job.</p>
<p><a href="http://homepage.mac.com/sebastianmorsch">Sebastian Morsch</a> <img src="http://www.hawkwings.net/images/extlink.jpg"/> has written a script that quits Mail, runs the sqlite commands and then relaunches Mail at the end of the process.  You can <a href="http://web.mac.com/sebastianmorsch/iWeb/Web-Site/Programming_files/OptimizeMail.scpt.zip">get the script</a> <img src="http://www.hawkwings.net/images/extlink.jpg"/> from his web site. </p>
<p>&#8220;pmbuko&#8221; has written another, which does the same thing (modified as suggested in the comments below by Romulo &#8212; Thanks!) :</p>
<p><span id="code">tell application &#8220;Mail&#8221; to quit<br />
set sizeBefore to do shell script &#8220;ls -lah ~/Library/Mail | grep -E &#8216;Envelope Index$&#8217; | awk {&#8216;print $5&#8242;}&#8221;<br />
do shell script &#8220;/usr/bin/sqlite3 ~/Library/Mail/&#8217;Envelope Index&#8217; vacuum&#8221;<br />
set sizeAfter to do shell script &#8220;ls -lah ~/Library/Mail | grep -E &#8216;Envelope Index$&#8217; | awk {&#8216;print $5&#8242;}&#8221;<br />
display dialog (&#8220;Mail index before: &#8221; &#038; sizeBefore &#038; return &#038; &#8220;Mail index after: &#8221; &#038; sizeAfter &#038; return &#038; return &#038; &#8220;Enjoy the new speed!&#8221;)<br />
tell application &#8220;Mail&#8221; to activate</span></p>
<p>It gives you some feedback on what happens:</p>
<div align=center><img src="http://www.hawkwings.net/wp-content/uploads/2007/03/optimisemailscript.jpg" alt="Optimisemailscript" height="196" width="391"/></div>
<p>You can grab the text of the second script above or <a href="http://www.hawkwings.net/files/OptimiseEnvelope.scpt.zip">download it in a zip file</a> I&#8217;ve uploaded to the site.</p>
<p>Obviously, the law of diminishing returns is in play here.  The first time you run it, the benefit is tremendous. Run it again soon after and there is not so much bloat to remove and, hence, not as great an improvement.</p>
<p><img src="http://www.hawkwings.net/wp-content/uploads/2007/03/icalalarm.jpg" alt="Icalalarm"  align="right" border="0" hspace="10" vspace="0" height="327" width="200"/>Still, as some have pointed out, this should be a regular maintenance routine for Mail.  You can wait for the Mail Development Team to implement it or with one of these rules and iCal, you can automate it yourself.</p>
<p>All you need to do is create a recurring event in iCal and use the &#8220;Run script&#8221; option in the alarm feature to run the script.</p>
<p>So, save the script somewhere sensible &#8212; I saved mine in the <span id="code">~/Library/Scripts/ Applications/Mail</span> folder.</p>
<p>Create the event. </p>
<p>Click on the alarm field in the event&#8217;s information pane, and select &#8220;Run script&#8221;.</p>
<p>When prompted, navigate to the script and select it.</p>
<p>I&#8217;ve added an end for the event after 100 instances because my Palm really hates events with no end date.  You may be luckier.</p>
<p>Now you can enjoy a lean Envelope Index long after you have forgotten about the tip. </p>
<p>[With thanks to Sebastian and pmbuko]</p>
<p><strong>UPDATE:</strong> If you prefer Automator to AppleScript, Steve Weintraub <a href="http://automatorworld.com/archives/mail-vacuum/">has created an Automator action</a> <img src="http://www.hawkwings.net/images/extlink.jpg"/> to do the same thing.<tags>mail.app, apple mail, applescript, scripts, automate, ical, tips, envelope, speed, sqlite, productivity</tags><strong>Similar Posts:</strong>
<ul class="similar-posts">
<li><a href="http://www.hawkwings.net/2007/03/01/a-faster-way-to-speed-up-mailapp/" rel="bookmark" title="1 March 2007, 11:08 pm">A faster way to speed up Mail.app</a></li>
<li><a href="http://www.hawkwings.net/2007/07/18/speedmail-slick-envelope-rebuilding-app-for-mail/" rel="bookmark" title="18 July 2007, 9:19 pm">SpeedMail: Slick Envelope Rebuilding app for Mail</a></li>
<li><a href="http://www.hawkwings.net/2006/02/08/rebuild-your-database-and-speed-up-mailapp/" rel="bookmark" title="8 February 2006, 12:57 am">Rebuild your database and speed up Mail.app</a></li>
<li><a href="http://www.hawkwings.net/2006/02/01/the-dreaded-your-home-directory-is-full-message/" rel="bookmark" title="1 February 2006, 11:26 am">The dreaded &#8220;your home directory is full&#8221; error</a></li>
<li><a href="http://www.hawkwings.net/2007/11/08/leopard-mail-and-the-envelope-speed-trick/" rel="bookmark" title="8 November 2007, 11:05 pm">Leopard Mail and the Envelope Speed Trick</a></li>
</ul>
<p><!-- Similar Posts took 6.613 ms --></p>
]]></content:encoded>
			<wfw:commentRss>http://www.hawkwings.net/2007/03/03/scripts-to-automate-the-mailapp-envelope-speed-trick/feed/</wfw:commentRss>
		<slash:comments>46</slash:comments>
		</item>
	</channel>
</rss>

