<?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>Ambient Ideas' Denver Dev &#187; Scripting</title>
	<atom:link href="http://ambientideas.com/blog/index.php/tag/scripting/feed/" rel="self" type="application/rss+xml" />
	<link>http://ambientideas.com/blog</link>
	<description>Matthew McCullough's insights on software development as co-founder of Ambient Ideas, LLC</description>
	<lastBuildDate>Wed, 21 Jul 2010 17:40:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>AppleScript to Re-Apply Finder Comments</title>
		<link>http://ambientideas.com/blog/index.php/2010/01/applescript-to-re-apply-finder-comments/</link>
		<comments>http://ambientideas.com/blog/index.php/2010/01/applescript-to-re-apply-finder-comments/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 16:55:29 +0000</pubDate>
		<dc:creator>Matthew McCullough</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[OpenSource]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://ambientideas.com/blog/index.php/2010/01/applescript-to-re-apply-finder-comments/</guid>
		<description><![CDATA[...depending on the Mac-specific intelligence of your backup solution, or when copying files written by a 10.4 Mac, your Spotlight (Finder) Comments stored in the .DS_Store files might not survive the round trip.]]></description>
			<content:encoded><![CDATA[<h1>Finder Comments Lost</h1>
<p>When restoring from a backup, depending on the Mac-specific intelligence of your backup solution, or when copying files written by a 10.4 Mac, your Spotlight (Finder) Comments stored in the <a href="http://en.wikipedia.org/wiki/.DS_Store">.DS_Store files</a> might not survive the round trip.  You&#8217;ll first notice this by the fact that your comments field or column is completely empty for files you know you previously tagged or made comments on.</p>
<h2>Leopard, Snow Leopard Comment Storage</h2>
<p>Tiger and previous editions of Mac OSX store Spotlight comments in the .DS_Store file exclusively.  Leopard and Snow Leopard on the other hand, claim to maintain backwards compatibility by storing the <a href="http://ironicsoftware.com/community/comments.php?DiscussionID=344">Spotlight Comments in both</a> the .DS_Store and the new <a href="http://en.wikipedia.org/wiki/Extended_file_attributes">Extended File Attributes.</a>  I question this thinking though, because Mac OSX developer Steve Gehrman of the <a href="http://www.cocoatech.com/">awesome PathFinder team</a> says that Finder, while it <a href="http://news.softpedia.com/news/iRemove-DS-Store-Files-AppleScript-Eliminates-Tons-of-Fuss-124047.shtml">writes both formats</a>, still only reads back the .DS_Store ones.  It seems to me that Apple would have changed Finder to read from the newer Extended Attributes as soon as they started writing to those in duplicate.</p>
<blockquote><p>&#8220;On Mac OS X 10.4 Tiger, for example, .DS_Store files also contain the Spotlight comments of all the folder&#8217;s files, whereas Mac OS X 10.5 &#8220;Leopard&#8221; stores this information in Extended file attributes.&#8221;</p></blockquote>
<h2>Script Research</h2>
<p>Giving a tip of the hat to the similar-but-not-quite-what-I-wanted script that helped me get enough of the syntax working (using type <code>alias</code> instead of type <code>file</code> was tricky) get my own authored, I give you:</p>
<p>A <a href="http://www.macosxhints.com/article.php?story=20050614071122965">MacOSXHints article</a>, and the <a href="http://www.macosxhints.com/dlfiles/spotlight_comment_script.txt">corresponding code</a></p>
<p>    <script src="http://gist.github.com/285988.js?file=spotlight-flag-comments.scpt"></script></p>
<h2>The Solution</h2>
<p>To solve this extended attributes vs. .DS_Store discrepancy, we only need to read (from the extended attributes) and reapply (thereby recreating the .DS_Store) the same comment.  The solution is this AppleScript.  Just highlight the files needing the treatment in Finder, then execute this script from the AppleScript Editor.</p>
<p><script src="http://gist.github.com/285667.js?file=recomment.scpt"></script></p>
<p>The result is that Finder (which reads only the .DS_Store files) and PathFinder (which only reads the extended attributes) can both now see the Spotlight Comments.</p>
<h3>Extras</h3>
<p>If you would like your Mac to automatically clean up the .DS_Store files it writes out to flash sticks and network drives, <a href="http://zeroonetwenty.com/blueharvest/">check out BlueHarvest</a>, an interesting little utility app that fills this need.</p>
]]></content:encoded>
			<wfw:commentRss>http://ambientideas.com/blog/index.php/2010/01/applescript-to-re-apply-finder-comments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Script for finding a class inside a directory of JARs</title>
		<link>http://ambientideas.com/blog/index.php/2009/06/script-for-finding-a-class-inside-a-directory-of-jars/</link>
		<comments>http://ambientideas.com/blog/index.php/2009/06/script-for-finding-a-class-inside-a-directory-of-jars/#comments</comments>
		<pubDate>Mon, 15 Jun 2009 01:43:02 +0000</pubDate>
		<dc:creator>Matthew McCullough</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Automation]]></category>
		<category><![CDATA[Maven]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[Scripting]]></category>

		<guid isPermaLink="false">http://ambientideas.com/blog/index.php/2009/06/script-for-finding-a-class-inside-a-directory-of-jars/</guid>
		<description><![CDATA[In the spirit of automating anything I've done more than twice manually, here's an incredibly simple yet useful little script to recursively search a tree of JARs for a class file.]]></description>
			<content:encoded><![CDATA[<p>In the spirit of automating anything I&#8217;ve done more than twice manually, here&#8217;s an incredibly simple yet useful little script to recursively search a tree of JARs for a class file.  I most often use this against a local Maven repository.</p>
<p><pre class="brush: bash;">
#!/bin/sh

#Example Usages:
# findjars com/ambientideas/SuperWidget
# findjars AnotherWidget

CLASSNAMETOFIND=&amp;amp;quot;$1&amp;amp;quot;

echo &amp;amp;quot;Searching all JARs recursively...&amp;amp;quot;
for eachjar in `find . -iname &amp;amp;quot;*.jar&amp;amp;quot;`
do
  #echo &amp;amp;quot;Searching in $eachjar ...&amp;amp;quot;
  jar tvf $eachjar | grep $CLASSNAMETOFIND &amp;amp;gt; /dev/null
  if [ $? == 0 ]
  then
    echo &amp;amp;quot;******* Located &amp;amp;quot;$CLASSNAMETOFIND&amp;amp;quot; in $eachjar *******&amp;amp;quot;
  fi
done
</pre></p>
]]></content:encoded>
			<wfw:commentRss>http://ambientideas.com/blog/index.php/2009/06/script-for-finding-a-class-inside-a-directory-of-jars/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
