<?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>plasticular inscriptor &#187; applescript</title>
	<atom:link href="http://www.plasticstare.com/plains/category/coding/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.plasticstare.com/plains</link>
	<description></description>
	<lastBuildDate>Thu, 02 Feb 2012 02:19:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Quicksilver Adium Message Script</title>
		<link>http://www.plasticstare.com/plains/2008/08/07/quicksilver-adium-message-script/</link>
		<comments>http://www.plasticstare.com/plains/2008/08/07/quicksilver-adium-message-script/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 03:59:18 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[quicksilver]]></category>
		<category><![CDATA[random]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=247</guid>
		<description><![CDATA[The Adium plug-in for Quicksilver has been kaput for quite a while now, and I have found myself as of late with folks at work I need to contact who keep themselves in the invisible state in their messenger (like my manager . I have come to loath having to go to Adium and go [...]]]></description>
			<content:encoded><![CDATA[<p>The Adium plug-in for Quicksilver has been kaput for quite a while now, and I have found myself as of late with folks at work I need to contact who keep themselves in the invisible state in their messenger (like my manager <img src='http://www.plasticstare.com/plains/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> . I have come to loath having to go to Adium and go to the menu bar with the mouse and select &#8220;show offline contacts&#8221; and then find the person I want to IM and click their name, then &#8220;hide offline contacts&#8221; again. I also don&#8217;t care about having to use the contact list interface anyway, really, if I didn&#8217;t have to, so I wrote this applescript to use in Quicksilver.</p>
<p>To install, uncompress this script and put it in your ~/Library/Application Support/Quicksilver/Actions directory, and restart Quicksilver.</p>
<p>To use, invoke Quicksilver and type &#8220;.&#8221; to enter text mode. Type all or part of the name of the person you wish to IM. Hit <Tab> and type &#8220;Adium&#8221; (or &#8220;Ad&#8221; or &#8220;Adi&#8221;) and select &#8220;AdiumContactor&#8221; with the arrow keys and hit <Return>.</p>
<p>The script will search for any instance of the text you enter in your contacts, both in their IM names, as well as their display names. If one match is found, it will open an IM window for that contact. If multiple contacts are found, a window will open allowing you to select the one you want, using whatever account it belongs to. (in other words, if you search &#8220;bil&#8221;, you will be able to choose from &#8220;Bill Todd&#8221;, bileInMyStomach@gmail.com, actionscriptAbility@hotmail.com, etc.) Careful using some search terms, such as &#8220;com&#8221;, as it will return all your MSN messenger accounts (whose screennames are defined by the contact&#8217;s email address)</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
AdiumContactor for Quicksilver (Aug. 07, 2008)<br />
Download (~10,000 bytes) :: <a href="http://www.plasticstare.com/plasticware/applescript/AdiumContactor.zip">AdiumContactor.zip</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/08/07/quicksilver-adium-message-script/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>quicksilver, curl, applescript, proxy-config, twitter</title>
		<link>http://www.plasticstare.com/plains/2008/08/05/quicksilver-curl-applescript-proxy-config-twitter/</link>
		<comments>http://www.plasticstare.com/plains/2008/08/05/quicksilver-curl-applescript-proxy-config-twitter/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 02:11:23 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[quicksilver]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=238</guid>
		<description><![CDATA[This explains how to use Quicksilver to send posts to Twitter from within a firewall. I made this my little lunch project today. First, let&#8217;s start with the basics. If you set up your work proxy server in your network config, there is not really any way to easily retrieve those settings. Let&#8217;s say you [...]]]></description>
			<content:encoded><![CDATA[<p>This explains how to use Quicksilver to send posts to Twitter from within a firewall. I made this my little lunch project today. First, let's start with the basics. If you set up your work proxy server in your network config, there is not really any way to easily retrieve those settings. Let's say you are using http://proxy.myco.com:3128 for your http proxy settings. In the Terminal, you have not actually set your http_proxy environment variable. <a href="http://www.cs.usyd.edu.au/%7Emassad/project-proxy-config.html">Mark Assad has proxy-config</a> available for download. You can grab that, put it in one of your path directories, and then in your .bashrc or .zshrc file the following:</p>
<pre class="brush: plain; light: true; title: ; notranslate">export http_proxy=`proxy-config -h`
export https_proxy=`proxy-config -s`
export ftp_proxy=`proxy-config -f`</pre>
<p>This will set your environment proxy variables to whatever they are currently set to in your Network Preferences. I got part of this also from <a href="http://tomayko.com/writings/os-x-network-location-support-from-the-command-line">Ryan Tomayko's blog</a>.This is important if you are inside a firewall at work.</p>
<p>The simplest way to post a tweet to twitter from the command line would be to do so using cURL. If you don't have cURL installed, you will need to install it. If you aren't familiar with cURL, it is basically a command-line tool for grabbing html documents (or whatever else). See <a href="http://www.plasticstare.com/plains/2008/03/20/copy-and-continue-copying-large-files-over-file-sharing/">this post</a> for another use. I got this idea, as well as the applescript for using it with Quicksilver, from <a href="http://blog.codahale.com/2007/01/15/tweet-twitter-quicksilver/">Coda Hale's blog</a>. Read that post for a full explanation of using Quicksilver and an applescript for posting to twitter from Quicksilver -- it has a pretty thorough explanation.</p>
<p>If you are inside a firewall, however, this will likely fail because the cURL command requires that the proxy settings be provided. So, I took the script from Coda's post, combined it with the comment on his post from Daan Kortenbach, and then enabled that for use with the system's proxy settings. The new script follows:</p>
<pre class="brush: plain; title: ; notranslate">
using terms from application &quot;GrowlHelperApp&quot;
	-- Register Growl
	on growlRegister()
		tell application &quot;GrowlHelperApp&quot;
			register as application &quot;Tweet&quot; all notifications {&quot;Alert&quot;} default notifications {&quot;Alert&quot;} icon of application &quot;Quicksilver.app&quot;
		end tell
	end growlRegister

	-- Notify using Growl
	-- Example: growlNotify(&quot;This is an Alert&quot;,&quot;This is a test of the Growl Alert System&quot;)
	on growlNotify(grrTitle, grrDescription)
		tell application &quot;GrowlHelperApp&quot;
			notify with name &quot;Alert&quot; title grrTitle description grrDescription application name &quot;Tweet&quot;
		end tell
	end growlNotify
end using terms from

using terms from application &quot;Quicksilver&quot;
	on process text tweet
		tell application &quot;Keychain Scripting&quot;
			set twitter_key to first Internet key of current keychain whose server is &quot;twitter.com&quot;
			set twitter_login to quoted form of (account of twitter_key &amp; &quot;:&quot; &amp; password of twitter_key)
		end tell
		set twitter_status to quoted form of (&quot;status=&quot; &amp; tweet)

                -- I have proxy-config in a directory &quot;~/bin&quot;
		set the_proxy to do shell script &quot;~/bin/proxy-config -h&quot;

		try
			if (the_proxy = &quot;&quot;) then
				set results to do shell script &quot;curl --user &quot; &amp; twitter_login &amp; &quot; --data-binary &quot; &amp; twitter_status &amp; &quot; http://twitter.com/statuses/update.json&quot;
			else
				set results to do shell script &quot;curl --proxy &quot; &amp; the_proxy &amp; &quot; --user &quot; &amp; twitter_login &amp; &quot; --data-binary &quot; &amp; twitter_status &amp; &quot; http://twitter.com/statuses/update.json&quot;
			end if
			growlRegister()
			growlNotify(&quot;Tweet Sent&quot;, tweet)
		on error
			(* In case curl fails for some reason,  alert us *)
			growlRegister()
			growlNotify(&quot;Error&quot;, &quot;There was an error sending your tweet.&quot;)
		end try

	end process text
end using terms from
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/08/05/quicksilver-curl-applescript-proxy-config-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Breakaway Saves My Ears</title>
		<link>http://www.plasticstare.com/plains/2008/07/30/breakaway-saves-my-ears/</link>
		<comments>http://www.plasticstare.com/plains/2008/07/30/breakaway-saves-my-ears/#comments</comments>
		<pubDate>Wed, 30 Jul 2008 18:15:23 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/?p=235</guid>
		<description><![CDATA[I wrote a post a while back about the pesky habit of my MacBook Pro trying to make me go deaf. I plug my laptop into a stereo via the headphone jack at home and listen to music. In order to get the sound levels right at home, I increase the volume to full volume [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a post a while back about the pesky habit of my MacBook Pro trying to make me go deaf. I plug my laptop into a stereo via the headphone jack at home and listen to music. In order to get the sound levels right at home, I increase the volume to full volume (otherwise I have to turn up the stereo and I get lots of noise and hum). When I leave in the morning, I unplug my laptop and the MacBook resets its volume to the pre-headphone jack volume. Fine. Unfortunately, when I get to work, I plug-in my headphones, start checking email, hit my keyboard command for iTunes play, and proceed to deafen myself with full volume, as the machine automatically resets the system volume to the previous headphone jack volume level.</p>
<p>Today I deafened myself, but upon searching, discovered <a href="http://balthamos.awardspace.com/applications/">Alloc Init</a>, which features a nice little app called <a href="http://www.macupdate.com/info.php/id/23361">Breakaway</a>. The main feature of this app is to pause iTunes or launch the screensaver when the headphone jack status is changed (plugged in or out). However, the nicer thing about the app is that it also allows the user to trigger an applescript on the same events. I created the following script called setVolumeTo20of100:</p>
<p><code>tell application "Finder"<br />
	set volume output volume 20<br />
end tell</code></p>
<p>After creating a custom trigger in Breakaway, my system volume will always be reset to 20 when I plug in something to the headphone jack. Since I don't care about having to increase the volume at home automatically, this is fine for now, since I will most importantly not deafen myself in the morning at work. I will perhaps post an update later that checks the the network preferences for the current location for setting the volume automatically based on location, which will automate things a little more. Meanwhile, I highly recommend this nice little app. (Note: the interface for creating custom triggers is a little clunky, so you may have to play with it a little first, but it does work -- just be patient.)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/07/30/breakaway-saves-my-ears/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scraping Source in Safari</title>
		<link>http://www.plasticstare.com/plains/2008/03/30/scraping-source-in-safari/</link>
		<comments>http://www.plasticstare.com/plains/2008/03/30/scraping-source-in-safari/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 01:19:22 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[downloadable]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2008/03/30/scraping-source-in-safari/</guid>
		<description><![CDATA[Here is an applescript solution for grabbing the html code from a page online. This is particularly handy if you are trying to grab the code from a page that you need to login to. I am sure there is a much better solution out there, but this one seems to work for me ok.]]></description>
			<content:encoded><![CDATA[<p>Here is an applescript solution for grabbing the html code from a page online. This is particularly handy if you are trying to grab the code from a page that you need to login to. I am sure there is a much better solution out there, but this one seems to work for me ok.</p>
<div class="igBar"><span id="lcode-1"><a href="#" onclick="javascript:showCodeTxt('code-1'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-1">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-- Define the page to save the document and the url</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set the pageFile to <span style="color:#CC0000;">"/Users/yourUserNameHere/Desktop/safariSource.html"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set the pageUrl to <span style="color:#CC0000;">"http://www.plasticstare.com/"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-- define the applescript to run</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tell application <span style="color:#CC0000;">"Safari"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;activate</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;make new document at end of documents</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;set URL of document <span style="color:#800000;color:#800000;">1</span> to pageUrl</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">end tell</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set web_page_is_loaded to false</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--check if page has loaded</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">repeat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;delay <span style="color:#800000;color:#800000;">0</span>.<span style="color:#800000;color:#800000;">5</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;tell application <span style="color:#CC0000;">"System Events"</span> to tell application process <span style="color:#CC0000;">"Safari"</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; if <span style="color:#006600; font-weight:bold;">&#40;</span>name of static text <span style="color:#800000;color:#800000;">1</span> of group <span style="color:#800000;color:#800000;">1</span> of window <span style="color:#800000;color:#800000;">1</span> as text<span style="color:#006600; font-weight:bold;">&#41;</span> begins with <span style="color:#CC0000;">"Contacting"</span> or <span style="color:#006600; font-weight:bold;">&#40;</span>name of static text <span style="color:#800000;color:#800000;">1</span> of group <span style="color:#800000;color:#800000;">1</span> of window <span style="color:#800000;color:#800000;">1</span> as text<span style="color:#006600; font-weight:bold;">&#41;</span> begins with <span style="color:#CC0000;">"Loading"</span> then</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;-- do nothing</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; else</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;exit repeat</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; end if</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;end tell</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">end repeat</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">tell application <span style="color:#CC0000;">"Safari"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;set siteSource to the source of document <span style="color:#800000;color:#800000;">1</span> as text</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;set theFile to open for access <span style="color:#006600; font-weight:bold;">&#40;</span>pageFile<span style="color:#006600; font-weight:bold;">&#41;</span> as POSIX file with write permission</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;set eof of theFile to <span style="color:#800000;color:#800000;">0</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;write siteSource to theFile</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp;close access theFile</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">end tell </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/03/30/scraping-source-in-safari/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Applescript Show Track in Finder</title>
		<link>http://www.plasticstare.com/plains/2008/03/11/applescript-show-track-in-finder/</link>
		<comments>http://www.plasticstare.com/plains/2008/03/11/applescript-show-track-in-finder/#comments</comments>
		<pubDate>Tue, 11 Mar 2008 20:44:13 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[downloadable]]></category>
		<category><![CDATA[music]]></category>
		<category><![CDATA[plasticware]]></category>
		<category><![CDATA[quicksilver]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2008/03/11/applescript-show-track-in-finder/</guid>
		<description><![CDATA[Space has been tight lately on my laptop and I've been too lazy to thoroughly go through and clean up. I keep regular backups, however, so I wrote this script so that when I hear a track that I don't care so much about in iTunes on random, I can go to the folder and [...]]]></description>
			<content:encoded><![CDATA[<p>Space has been tight lately on my laptop and I've been too lazy to thoroughly go through and clean up. I keep regular backups, however, so I wrote this script so that when I hear a track that I don't care so much about in iTunes on random, I can go to the folder and kill the track or the album, or heck, all tracks by that artist, quickly. You can put this file in your iTunes scripts folder and trigger it from Quicksilver as well for easy access.</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
Show Track in Finder (Mar. 11, 2008)<br />
Download (~3,146 bytes) :: <a href="http://www.plasticstare.com/plasticware/applescript/ShowTrackInFinder.zip">ShowTrackInFinder.zip</a></span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2008/03/11/applescript-show-track-in-finder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Teach iTunes to Growl on Command</title>
		<link>http://www.plasticstare.com/plains/2007/10/21/teach-itunes-to-growl-on-command/</link>
		<comments>http://www.plasticstare.com/plains/2007/10/21/teach-itunes-to-growl-on-command/#comments</comments>
		<pubDate>Mon, 22 Oct 2007 03:41:38 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[quicksilver]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2007/02/05/teach-itunes-to-growl-on-command/</guid>
		<description><![CDATA[Update: Changed the script to make the formatting better and include the album art of the track. Thanks to Freek in the comments below for a couple of ideas. The track info is copied directly from his comments, and I didn't yet get a chance to reformat that -- maybe soon... Haven't posted anything useful [...]]]></description>
			<content:encoded><![CDATA[<p>Update: Changed the script to make the formatting better and include the album art of the track. Thanks to Freek in the comments below for a couple of ideas. The track info is copied directly from his comments, and I didn't yet get a chance to reformat that -- maybe soon...</p>
<p>Haven't posted anything useful here for a while so I thought I'd put something together today and post it -- something that I've wanted for a while. Occasionally when I want to zone out at work I just put iTunes in random, hide it, and go. Unfortunately, I end up wasting time flipping iTunes open and then hiding it again when I can't remember a track name or artist or album. I've been meaning to put together something to use in Quicksilver to enable being able to take a peek at what is playing, namely using the OSX system extension Growl. Download this:</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
Growl Track Info (Oct. 21, 2007)<br />
Download (~3,645 bytes) :: <a href="http://www.plasticstare.com/plasticware/applescript/growl_track_info.zip">growl_track_info.zip</a></span></p>
<p>I can't remember why I have Growl on my system, that is, what application or system version first installed it, so if you don't have Growl, you can find it here: <a href="http://growl.info/">http://growl.info/</a>. Basically, if you aren't familiar with it, Growl allows for (sometimes annoying) pop-up bubbles that can notify you of things going on with applications that are currently not in the foreground (for example, when an upload completes in Transmit, or when you get an incoming message in Adium or iChat).Once you've installed Growl (or check to see if it exists in your System Prefs), download the script linked above, unzip it, and place it in your iTunes scripts folder (/Users/~YourUserName/Library/iTunes/Scripts). Now, if you restart iTunes, the script should show up in your iTunes applescript menu, and you can choose the script and see that it triggers the Growl pop-up -- which really isn't terribly interesting since you are already staring at iTunes anyway.</p>
<p>Now, assuming that you have Quicksilver installed on your system, you can add a custom trigger as seen below.<br />
<img src="/plasticware/applescript/growl_track_info.png" /><br clear="all" /><br />
To add the trigger, open Quicksilver and go to Catalog. Select Modules and make sure that you have the iTunes module showing there. If not, you need to enable the iTunes module. Click the circle arrow thing on the bottom right to rescan your catalog - you may notice that the count for the iTunes applescripts increases by 1. Next, select Triggers, and then select Custom Triggers. Find the little plus sign button at the middle bottom and choose HotKey. This will slide open a Quicksilver selector thing, whatever it's called. You can now type part of "growl track info" the same way as you would normally using Quicksilver, and select the Applescript "Growl Track Info.scpt" where it shows up in the list; it will default to Run as the action, which is fine. Now double click the line in the Trigger column on the right and set up your hotkey for On Press (my friends make fun of me for choosing something like Control-Option-Command-Shift-I so I can just mash the bottom left of the keyboard and one other letter and not interfere with other application keystrokes, but if you do that I won't make fun of you). You should now be able to hide iTunes and use the Quicksilver trigger to see whats playing in iTunes, as well as control iTunes with the rest of the iTunes module available for Quicksilver, and free up whatever corner of your screen you were keeping the mini player before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2007/10/21/teach-itunes-to-growl-on-command/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Textmate: Run Command in Terminal</title>
		<link>http://www.plasticstare.com/plains/2006/12/12/textmate-run-command-in-terminal/</link>
		<comments>http://www.plasticstare.com/plains/2006/12/12/textmate-run-command-in-terminal/#comments</comments>
		<pubDate>Wed, 13 Dec 2006 07:55:04 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[apple]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/12/12/textmate-run-command-in-terminal/</guid>
		<description><![CDATA[Maybe this exists already - I couldn't find it, so I just wrote it. Of course, I am putting this here as code, but one day I'll publish a new bundle of TextMate commands which includes this and some of the other ones I've put together. I was looking around today for some commands that [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe this exists already - I couldn't find it, so I just wrote it. Of course, I am putting this here as code, but one day I'll publish a new bundle of TextMate commands which includes this and some of the other ones I've put together. I was looking around today for some commands that I might use to augment the Perforce bundle -- specifically, I needed a dialog. What I found was some references to the use of CocoaDialog, which is pretty handy. Another use I had envisioned for dialogs in a TextMate command was to be able to run terminal commands *in* the Terminal. After all, sometimes you would like to have something run and dump its output right there in the Terminal, rather than in a new TextMate document or something like that. The Apple Terminal is pretty nice for what it is, and its much better than the Linux KDE terminal, the Windows terminal, and the poor bastard Windows Cygwin terminal.<br />
To set up this in TextMate, open the Bundle Editor and create a new Command. Set the command to Save "Nothing", Input "None", and Output "Discard". Give it a key command if you like, and leave the Scope Selector blank. In the Command(s) field, paste the following:</p>
<div class="igBar"><span id="lcode-2"><a href="#" onclick="javascript:showCodeTxt('code-2'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-2">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">#!/bin/bash</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># First use CocoaDialog to pop a dialog to get</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># the command you would like to run.</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="">res</span>=$<span style="color:#006600; font-weight:bold;">&#40;</span>CocoaDialog inputbox --title <span style="color:#CC0000;">"Run Command in Terminal Window"</span> --informative-text <span style="color:#CC0000;">"Enter the command here:"</span> --button1 <span style="color:#CC0000;">"Okay"</span> --button2 <span style="color:#CC0000;">"Cancel"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># if the cancel button was pressed then exit</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#91;</span> $<span style="color:#006600; font-weight:bold;">&#40;</span>head -n1 &lt;&lt;&lt;<span style="color:#CC0000;">"$res"</span><span style="color:#006600; font-weight:bold;">&#41;</span> == <span style="color:#CC0000;">"2"</span> <span style="color:#006600; font-weight:bold;">&#93;</span><span style="color:#006600; font-weight:bold;">&#93;</span> &amp;&amp; exit_discard</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># set the command string to what was entered</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">command=$<span style="color:#006600; font-weight:bold;">&#40;</span>tail -n1 &lt;&lt;&lt;<span style="color:#CC0000;">"$res"</span><span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># create our applescript which will launch a</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># new Terminal window if there is not one running</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># and otherwise run the command we want in the</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># current running Terminal window</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">aplscr=<span style="color:#CC0000;">"tell application <span style="color:#000099; font-weight:bold;">\"</span>System Events<span style="color:#000099; font-weight:bold;">\"</span> to set terminalRunning to (exists process <span style="color:#000099; font-weight:bold;">\"</span>Terminal<span style="color:#000099; font-weight:bold;">\"</span>)</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">if (not terminalRunning) then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">tell application <span style="color:#000099; font-weight:bold;">\"</span>Terminal<span style="color:#000099; font-weight:bold;">\"</span> to activate</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">tell application <span style="color:#000099; font-weight:bold;">\"</span>Terminal<span style="color:#000099; font-weight:bold;">\"</span> to do script <span style="color:#000099; font-weight:bold;">\"</span>$command<span style="color:#000099; font-weight:bold;">\"</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">else</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">tell application <span style="color:#000099; font-weight:bold;">\"</span>Terminal<span style="color:#000099; font-weight:bold;">\"</span> to activate</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">tell application <span style="color:#000099; font-weight:bold;">\"</span>Terminal<span style="color:#000099; font-weight:bold;">\"</span> to do script <span style="color:#000099; font-weight:bold;">\"</span>$command<span style="color:#000099; font-weight:bold;">\"</span> in front window</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#CC0000;">end if"</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"># execute the applescript</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">osascript -e <span style="color:#CC0000;">"$aplscr"</span> &amp;&gt;/dev/null &amp; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>In a nutshell, as the comments indicate, we capture the contents of the field in the dialog that is opened, and stick them into the applescript that we want to run. The applescript part checks to see if there is already a Terminal session window open, and  will run the command in the Terminal. If Terminal isn't open, then it launches it. You (or maybe me in the future) could fancy this up a bit if you wanted by having the Terminal change directory to the directory in which the file you are working on exists. Not sure that is always desirable though for my purposes.</p>
<p>Enjoy it. (if you're a total geek you probably will, at least in principle)</p>
<p>Additional work needed:<br />
1. Escape quotes (you have to do that manually now).<br />
2. Have Terminal spawn a new window if it is already running but has no open windows. (need to check for window count in addition to process running)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/12/12/textmate-run-command-in-terminal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Textmate Open to New Project Window</title>
		<link>http://www.plasticstare.com/plains/2006/11/02/textmate-open-to-new-project-window/</link>
		<comments>http://www.plasticstare.com/plains/2006/11/02/textmate-open-to-new-project-window/#comments</comments>
		<pubDate>Fri, 03 Nov 2006 02:46:04 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/11/02/textmate-open-to-new-project-window/</guid>
		<description><![CDATA[Something that has bothered me for a while in TextMate is that in the project drawer you can open a single file in a new window. Often, I like to open a new scratch project window to edit certain files that may also be in the project itself. A simple solution to this is to [...]]]></description>
			<content:encoded><![CDATA[<p>Something that has bothered me for a while in TextMate is that in the project drawer you can open a single file in a new window. Often, I like to open a new scratch project window to edit certain files that may also be in the project itself. A simple solution to this is to create a new TextMate command (I called it "Open from Drawer" since it allows you to simply open a single file, even though it opens in the same project window). Set the Save to "Nothing", and the Input and Output to "None" and "Discard". In the Commands field, enter the following:</p>
<pre>&#35;&#33;&#47;bin&#47;sh
osascript -e "tell application \"TextMate\" to open POSIX file \"$TM_SELECTED_FILE\""
</pre>
<p>You can set a Key Equivalent if you like. When done, select a folder in your project drawer. If the folder is a file system folder (rather than a group), the script will spawn a new project window containing all the files in that folder. Selecting a "group" folder will do nothing (may work on that one later...).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/11/02/textmate-open-to-new-project-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TextMate Window Arrangement &#8211; Tiling</title>
		<link>http://www.plasticstare.com/plains/2006/11/02/textmate-window-arrangement-tiling/</link>
		<comments>http://www.plasticstare.com/plains/2006/11/02/textmate-window-arrangement-tiling/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 08:35:40 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[technology]]></category>
		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/11/02/textmate-window-arrangement-tiling/</guid>
		<description><![CDATA[PlasticWare Downloadable :: Tile Windows Version 1.0 (Nov. 1, 2006) Download (~4k) :: TMBundle.zip So I spent a few minutes looking about today for something that would allow me to tile my open windows in TextMate. I couldn't find anything except for people wishing that TextMate could arrange windows like BBEdit, so I mocked up [...]]]></description>
			<content:encoded><![CDATA[<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
Tile Windows Version 1.0 (Nov. 1, 2006)<br />
Download (~4k) :: <a href="http://www.plasticstare.com/plasticware/textmate/TMBundle.zip">TMBundle.zip</a></span></p>
<p>So I spent a few minutes looking about today for something that would allow me to tile my open windows in TextMate. I couldn't find anything except for people wishing that TextMate could arrange windows like BBEdit, so I mocked up a little applescript application and then copied it over into a TextMate command in the bundle editor wrapped in an osascript call. Its by far not perfect, but here is what it does in a nutshell. </p>
<p>The script gets all the TextMate windows and, for now, grabs only the ones that are both zoomable and visible. I didn't yet filter out some of the possible windows that would be caught by this that you wouldn't want, such as the Bundle Editor window, but I wanted to get something working. It then runs through the windows and does a little math to determine which of the windows is closest to where the new positions should be, and moves them. This algorithm isn't perfect, but it does ok. The default minimum window width is 700px. The default setting for the key command is control-option-command-shift-T (didn't want to overwrite something else <img src='http://www.plasticstare.com/plains/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  ).</p>
<p>You should be able to unzip and install the bundle as you would any other TextMate bundle. Enjoy it, and if you have any thoughts, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/11/02/textmate-window-arrangement-tiling/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Keep Alive in Transmit</title>
		<link>http://www.plasticstare.com/plains/2006/08/31/keep-alive-in-transmit/</link>
		<comments>http://www.plasticstare.com/plains/2006/08/31/keep-alive-in-transmit/#comments</comments>
		<pubDate>Thu, 31 Aug 2006 21:51:38 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/08/31/keep-alive-in-transmit/</guid>
		<description><![CDATA[Thanks to Leslie at Panic.com for a speedy reply to my inquiry. I have had a problem for some time with a couple of FTP servers killing or timing out my connection. Where this gets to be a real headache was when editing ftp files through BBEdit or TextMate; if the connection timed out and [...]]]></description>
			<content:encoded><![CDATA[<p>Thanks to Leslie at Panic.com for a speedy reply to my inquiry. I have had a problem for some time with a couple of FTP servers killing or timing out my connection. Where this gets to be a real headache was when editing ftp files through BBEdit or TextMate; if the connection timed out and I tried to save the file, half the time it would overwrite my file on the server with an empty file - which was really *not* good. Transmit back in the day had a preference that you could check to send a "tickle" to the server to make it think you were occupied, and thus not kick you off.</p>
<p>Transmit 3.5 or greater provides a similiar, albeit more hidden, functionality. To enable this keep-alive functionality:</p>
<p>1. Go to the Transmit menu, hold down the Option key, and click Advanced preferences. You will see a list with only (Default) in it.<br />
2. Click the "+" to add a new server specific setting.<br />
3. Enter the offending kickoff server address in the address field, and check the checkbox "Keep connections alive during long transfers."</p>
<p>This should do the trick. If you would rather create your own home-grown applescript version, the refresh command was recently added to the Applescript library for Transmit, which you can trigger by sending the session in question a "refresh list their stuff files" command in applescript. (perhaps more on that later)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/08/31/keep-alive-in-transmit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smb Connector Applescript</title>
		<link>http://www.plasticstare.com/plains/2006/08/26/smb-connector-applescript/</link>
		<comments>http://www.plasticstare.com/plains/2006/08/26/smb-connector-applescript/#comments</comments>
		<pubDate>Sat, 26 Aug 2006 05:16:24 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[technology]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains/2006/08/26/smb-connector-applescript/</guid>
		<description><![CDATA[*Update (2007-01-05) - forgot to change this a long while ago, but was looking at some posts online and remembered that I hadn't updated this. The .nsmbrc file, as it turns out, isn't really necessary, as the finder will likely prompt you to enter the password for a share that you are trying to mount [...]]]></description>
			<content:encoded><![CDATA[<p>*Update (2007-01-05) - forgot to change this a long while ago, but was looking at some posts online and remembered that I hadn't updated this. The .nsmbrc file, as it turns out, isn't really necessary, as the finder will likely prompt you to enter the password for a share that you are trying to mount using the code in the applescript included here. If you like, at that point, you can enter your password and save it to the keychain, which is more secure than saving the password in the .nsmbrc file. Original article follows:</p>
<p>--</p>
<p>More may follow on this later, if I can determine a decent way of implementing this as a distributable applet, but what follows is a decent way of getting around the awkward samba dismount problem that I discuss in my earlier post.</p>
<p>To recap, there are some problems when developing on your Mac where you need to utilize a consistent volume location through an smb connected shared drive. (A good example of this is developing a project through Eclipse and wanting to write an Ant script that as one of its targets installs the build on the samba connected volume (which could be your development server environment).) A) Sometimes, remounting the shared volume results in unexpected naming in your /Volumes directory - so a windows share "D$" now becomes "D$-1", so now your Ant script will fail. B) Personally, I have grown to dislike the OSX connect to server dialog window - there is a lack of control there and a lack of knowing exactly what is going on. C) Running a mount_smbfs begins to solve the problems above, but is only part of the solution.</p>
<p><span id="more-113"></span></p>
<p>So, as I said, the mount_smbfs command in the terminal does allow you to specify a particular directory to use as your mount point for a shared volume. However, without tweaking your system, you can only access the share through the terminal (Ant scripts running through Eclipse can't access the drive either). The following is the [hacky, convoluted] solution:</p>
<p><strong>Change the permissions on /Volumes</strong><br />
For any of the users on your machine to access /Volumes for what we need to do, the permissions must be changed. Changing the permissions also allows the mounted directory to be accessed via the Finder (and Eclipse, etc.), rather than just in the terminal. Launch the terminal. (NOTE: you must have the root user enabled.) Type the following, hit enter, and enter the root user password when prompted:</p>
<pre>sudo chmod 777 /Volumes</pre>
<p><strong>Define Your Variables</strong><br />
Figure out what the different pieces of information are that you need (will be used in the following sections).<br />
{shareAddress} = the ip address or computer name to which you are linking<br />
{shareLoginName} = the user name used to login to the remote computer<br />
{computerShare} = the sharepoint on the computer (such as C$ if C: were shared on the windows machine)<br />
{sharePassword} = password for the share<br />
{shareWorkgroup} = the workgroup for the share login<br />
{localMountDir} = the directory which is aliased as the remote mounted drive - name this what you want (I used "wsd" for windows shared drive).</p>
<p><strong>Edit your .nsmbrc File</strong><br />
Go back to the terminal and navigate to your user folder (type "cd ~/" and return). Edit the .nsmbrc file using pico (type "pico .nsmbrc" and hit return). Type the following in the pico editor (substituting the terms in the curly braces with the info you collected above):</p>
<pre>[{shareAddress}:{shareLoginName}:{computerShare}]
addr={shareAddress}
password={sharePassword}
workgroup={shareWorkgroup}</pre>
<p>If the file already has contents, just enter the lines below what exists (leave a blank line in between). When you are done, hit Control-X, then hit Y to agree to save the changes, and you are done with that (back to your prompt in the terminal). Now chmod that file to 0600 (type "chmod 0600 .nsmbrc" and return). The .nsmbrc file is referenced when you call the mount command, so that the login information and password is ready-at-hand. Chmod'ing it to 0600 provides system permissions protection for your password therein.</p>
<p><strong>Create a little Applescript app (why not?)</strong><br />
Open the Application/Applescript/Script Editor application and create a new script (probably will open a new one by default). Enter the following code in the window, again replacing the curly bracket terms with your information.</p>
<div class="igBar"><span id="lcode-3"><a href="#" onclick="javascript:showCodeTxt('code-3'); return false;">View as Plain Text<img class="poparrow" src="http://www.plasticstare.com/plains/wp-content/plugins/ig_syntax_hilite/img/poparrow.gif"/></a></span></div>
<div class="syntax_hilite"><span class="langName">CODE:</span>
<div id="code-3">
<div class="code">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set shareUser to <span style="color:#006600; font-weight:bold;">&#123;</span>shareLoginName<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set shareLoc to <span style="color:#006600; font-weight:bold;">&#123;</span>shareAddress<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set mountDir to <span style="color:#006600; font-weight:bold;">&#123;</span>localMountDir<span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set volumesDir to <span style="color:#CC0000;">":Volumes:"</span> &amp; mountDir</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">set cmdDir to <span style="color:#CC0000;">"/Volumes/"</span> &amp; mountDir</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">--</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">try</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">alias <span style="color:#006600; font-weight:bold;">&#40;</span>volumesDir<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-- <span style="color:#FF9933; font-style:italic;">// do nothing if it exists</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">on error</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">-- <span style="color:#FF9933; font-style:italic;">// create the file if it does not exist</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do shell script <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"mkdir "</span> &amp; cmdDir<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">end try</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">do shell script <span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#CC0000;">"mount_smbfs //"</span> &amp; shareUser &amp; <span style="color:#CC0000;">"@"</span> &amp; shareLoc &amp; <span style="color:#CC0000;">" "</span> &amp; cmdDir<span style="color:#006600; font-weight:bold;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">display dialog cmdDir &amp; <span style="color:#CC0000;">" is mounted."</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Basically, this applescript determines whether or not the directory to which you would like to mount the smb volume already exists (which the OSX connect to server fuctionality doesn't do), and if not, creates it. Also, unlike the connect to server window, you can specify what you want it to be called. The shell command is then called to mount the shared volume. As a final touch, when the volume is mounted (which can take a little bit of time), an alert pops up to let you know that the smb mounted drive is ready to go.</p>
<p>Now, in Script Editor, choose File/Save As. Enter a name to save as, choose the File Format of "application bundle" from the drop down menu, click off the "Startup Screen" checkbox and save. (incidentally, application bundles are now universal binaries, and I believe the application format is still run through Rosetta on the newer Macs)</p>
<p>Now you should be able to simply double-click your little applescript app whenever you want to connect to the remote server of interest without opening the terminal or the connect to server window. You can access the shared drive by navigating to Volumes on your hard drive. At some point here, the drive will show up as a server in your finder window and will be named whatever its name is designated on the remote machine - regretably, clicking the eject button won't dismount it (this method isn't perfect after all). You can unmount the drive by typing "umount /Volumes/{localMountDir}" in the terminal and hitting return...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/08/26/smb-connector-applescript/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flickr Phun</title>
		<link>http://www.plasticstare.com/plains/2006/04/09/flickr-phun/</link>
		<comments>http://www.plasticstare.com/plains/2006/04/09/flickr-phun/#comments</comments>
		<pubDate>Sun, 09 Apr 2006 20:15:46 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[travel]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=72</guid>
		<description><![CDATA[So a couple of days ago I started the arduous task of uploading my archived mobile device photos to Flickr (user name intafon). I have uploaded a large number of photos now and have ended up trading off uploading tools do to some trouble I was having with one of them. The Flickr sponsored upload [...]]]></description>
			<content:encoded><![CDATA[<p>So a couple of days ago I started the arduous task of uploading my archived mobile device photos to Flickr (<a href="http://www.flickr.com/photos/intafon/">user name intafon</a>). I have uploaded a large number of photos now and have ended up trading off uploading tools do to some trouble I was having with one of them. The Flickr sponsored upload tool began after some time to experience some XML parsing error and would no longer insert the photos I was uploading into the set to which I wanted to upload them, so I switched over to the other sponsored tool entitled "1001", which has some advantages over the Flickr upload tool anyway, such as being able to select multiple images in your upload queue for selective tagging. Its big downfall for me is the inability to parse tags with quotes, so if you tag something "german shepherd" it tags them as "german" and "shepherd" -- a flaw that is not a problem in the Flickr Upload Tool.</p>
<p>All in all, Flickr has come a long way - to the point that I will actually use it now, and the tools around it have become pretty useable. The site itself, however, still needs some usability treatment. I do wish that the ability to change "taken on" dates was included in the batch processing, although I will concede that the percentage of people uploading from many different dates in the past is probably pretty slim, and the ability to read EXIF tags from jpegs is pretty great.</p>
<p>The problem, however, with EXIF tags (in my case especially) is that many devices that take photos (palm pilot and my samsung phone for example) do not include properly formatted EXIF data in the captured photos. Fortunately, most of my archived photos were named in such a way that the date taken is embedded into the file name of the photo, so I was able to build a little applescript application for OSX that uses the perl Image::ExifTool module to batch insert the proper EXIF data into my photos based on their filenames. (I also have the device indicated in the filename, so I was able to insert the camera device into the EXIF data as well, which also shows up on Flickr). Now, all my photos can be ordered by date taken, which makes more sense as they span from back in 2003.</p>
<p>,,, more later...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/04/09/flickr-phun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Oblique Strategies iChat Status</title>
		<link>http://www.plasticstare.com/plains/2006/01/18/oblique-strategies-ichat-status/</link>
		<comments>http://www.plasticstare.com/plains/2006/01/18/oblique-strategies-ichat-status/#comments</comments>
		<pubDate>Thu, 19 Jan 2006 06:47:24 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[geek]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=67</guid>
		<description><![CDATA[Jenna turned me onto Brian Eno and Peter Schmidt's Oblique Strategies which were published a few times as a set of cards -- the idea being to choose a card at random when you were stuck in your work (music, that is for Eno), and this random thought would help you figure things out a [...]]]></description>
			<content:encoded><![CDATA[<p>Jenna turned me onto Brian Eno and Peter Schmidt's <em>Oblique Strategies</em> which were published a few times as a set of cards -- the idea being to choose a card at random when you were stuck in your work (music, that is for Eno), and this random thought would help you figure things out a bit.</p>
<p>She was using a web-site that would allow you to browse them and had included it in her status message in iChat. I asked her about it and she remarked that it would be cool to just have a little quick app that would stick a random strategy in your iChat status. </p>
<p>Ask, and you shall receive. The Oblique Strategy Status package includes 2 Applescript applications. The first, iChatObliqueStrategyStatus, will run once and change your status to a random strategy. The second, iChatObliqueStrategyStatusRepeater, is for the more gear-headed I guess. It basically runs as an Applescript application that stays open and changes your status every 5 minutes to a new strategy (keeps your buddies guessing).</p>
<p><span class="downloadable"><em>PlasticWare Downloadable ::</em><br />
Oblique Strategy Status Version 1.0 (Jan. 18, 2006)<br />
Download for iChat OSX :: <a href="http://www.plasticstare.com/plasticware/applescript/ObliqueStrategyStatus.zip">ObliqueStrategyStatus.zip</a><br />
Download for Adium OSX :: <a href="http://www.plasticstare.com/plasticware/applescript/ObliqueStrategyStatusAdium.zip">ObliqueStrategyStatusAdium.zip</a></span></p>
<p>*Update :: 20060120 :: Corrected the strategy array to fix an errant odd character that was in the original content source which caused one of the strategies to truncate.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2006/01/18/oblique-strategies-ichat-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Applescript Date/Time File Renamer Folder Action</title>
		<link>http://www.plasticstare.com/plains/2005/11/24/applescript-datetime-file-renamer-folder-action/</link>
		<comments>http://www.plasticstare.com/plains/2005/11/24/applescript-datetime-file-renamer-folder-action/#comments</comments>
		<pubDate>Thu, 24 Nov 2005 20:58:18 +0000</pubDate>
		<dc:creator>plains</dc:creator>
				<category><![CDATA[applescript]]></category>
		<category><![CDATA[plasticware]]></category>

		<guid isPermaLink="false">http://www.plasticstare.com/plains_wp/?p=60</guid>
		<description><![CDATA[This is version 1.0 of the renameToDateTimeAndMoveToDateFolder Applescript Folder Action. I created it in order to rename photos taken using a Palm Zire 71, which doesn't have very configurable file naming conventions for the photos taken. The Deyel photo gallery engine that I created in PHP reads jpg photos from directories named with the day [...]]]></description>
			<content:encoded><![CDATA[<p>This is version 1.0 of the renameToDateTimeAndMoveToDateFolder Applescript Folder Action. I created it in order to rename photos taken using a Palm Zire 71, which doesn't have very configurable file naming conventions for the photos taken. The Deyel photo gallery engine that I created in PHP reads jpg photos from directories named with the day that the photo was taken, and the file names must reflect the date/time stamp. So, I wrote this Folder Action to do the job of renaming them appropriately.</p>
<p>Place this applescript in the _root/Library/Scripts/Folder Action Scripts/ directory. Then apply it to a folder of your choice by command clicking on the folder and choosing Attach Folder Action (you must have folder actions enabled).</p>
<p>When the action has been applied to a folder, the script will take any files matching the extension list or the type list and rename them according to the creation date using the format "YYYYMMDDHHMMSS.EXT" and will place them in a folder (create it if necessary) for the day the file was created with the format "YYYY-MM-DD" inside the folder to which the action is applied.</p>
<p>This is handy for organizing digital photos, since most digital cameras give the photos non-meaningful names. This script does NOT use the jpeg EXIF metadata tag. The name is created using the creation date assigned to the file, which may or may not be passed to the file when syncing with the desktop machine. (This was originally created to rename photos synced from the Palm Zire 71). Use at your own risk.</p>
<p>Version 1.0 (Nov. 24, 2005)</p>
<p>Download :: <a href="http://www.plasticstare.com/plasticware/applescript/renametodatetimeandmovetodatefolder.zip">renameToDateTimeAndMoveToDateFolder.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.plasticstare.com/plains/2005/11/24/applescript-datetime-file-renamer-folder-action/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

