<?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>Martin Ström &#187; applescript</title>
	<atom:link href="http://my-domain.se/tag/applescript/feed/" rel="self" type="application/rss+xml" />
	<link>http://my-domain.se</link>
	<description></description>
	<lastBuildDate>Wed, 30 Jun 2010 16:47: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>A better Mail-to-Things-ToDo script</title>
		<link>http://my-domain.se/a-better-mail-to-things-todo-script/</link>
		<comments>http://my-domain.se/a-better-mail-to-things-todo-script/#comments</comments>
		<pubDate>Mon, 10 May 2010 11:08:09 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[automator]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[things]]></category>

		<guid isPermaLink="false">http://my-domain.se/?p=332</guid>
		<description><![CDATA[Until now I&#8217;ve been creating todos in Things from Mail messages in OS X using the quick entry built into Things and the &#8220;autofill&#8221; feature. But I didn&#8217;t like that it, by default, created the todos in Things&#8217; Inbox and that I had to manually select text in the mail message to get it as [...]]]></description>
			<content:encoded><![CDATA[<p>Until now I&#8217;ve been creating todos in Things from Mail messages in OS X using the <a href="http://culturedcode.com/things/wiki/index.php/Quick_Entry_and_Autofill">quick entry built into Things and the &#8220;autofill&#8221; feature</a>. But I didn&#8217;t like that it, by default, created the todos in Things&#8217; Inbox and that I had to manually select text in the mail message to get it as notes (which is important when using Things on your iPhone/iPad when the link back to the mail message doesn&#8217;t work).</p>

<p>Instead here&#8217;s an AppleScript which will take the selected message(s) and automatically create one task for each email in the &#8220;Next&#8221; focus in Things. It will then archive the mail messages and show a Growl notification. The todos in Things will get tagged with the &#8220;Reply&#8221; tag (which in my setup is a subtag of &#8220;Email&#8221;). </p>

<p><img src="http://my-domain.se/wordpress/wp-content/uploads/2010/05/Screen-shot-2010-05-10-at-13.01.25.png" alt="" title="Growl" width="292" height="118" class="alignright size-full wp-image-338"></p>

<p><img src="http://my-domain.se/wordpress/wp-content/uploads/2010/05/Screen-shot-2010-05-10-at-12.53.501.png" alt="" title="Things" width="584" height="152" class="alignnone size-full wp-image-337" /></p>

<p>The script is a modified version of <a href="http://the.taoofmac.com/space/dev/AppleScript/Mail%20Archive">the one found here</a>. I also put the script in an Automator action like described in the article so you can assign a shortcut key to it without including third party software. </p>

<script src="http://gist.github.com/395910.js"></script>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/a-better-mail-to-things-todo-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically iChat complete Transmission downloads</title>
		<link>http://my-domain.se/automatically-ichat-complete-transmission-downloads/</link>
		<comments>http://my-domain.se/automatically-ichat-complete-transmission-downloads/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 23:23:21 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[folder actions]]></category>
		<category><![CDATA[ichat]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[torrent]]></category>
		<category><![CDATA[transmission]]></category>

		<guid isPermaLink="false">http://my-domain.se/?p=310</guid>
		<description><![CDATA[Lets say you have an extra computer at home which can be used to download Linux distros using Transmission on Mac OS X. Here&#8217;s how you can let the computer iChat you when a download is complete. Sign up for a new iChat screen name and add your normal user as a buddy. In Transmission, [...]]]></description>
			<content:encoded><![CDATA[<p>Lets say you have an extra computer at home which can be used to download Linux distros using Transmission on Mac OS X. Here&#8217;s how you can let the computer iChat you when a download is complete.</p>

<ol>
<li>Sign up for a new iChat screen name and add your normal user as a buddy.</li>
<li>In Transmission, open Preferences 
→ Transfers and set the folder for incomplete files to something different than the &#8220;Default download location&#8221;. </li>
<li>Start Automator (in /Applications) and create a new workflow</li>
<li>Add the &#8220;Run AppleScript&#8221; action and paste in this code (replace YOURBUDDY with the scree name of your own iChat account:</li>
<li>Save as a plugin and choose &#8220;Folder action&#8221; in the &#8220;Save As&#8221; dialog. Select the folder you setup Transmission to use as the &#8220;Default download location&#8221;. <script src="http://gist.github.com/323285.js?file=iChat+Added+Files.applescript"></script></li>
<li>Done! The script should now send you an iChat message whenever a new file is added to the folder.</li>
</ol>

<p>I created this setup a pretty long time ago and still use it, but these days together with a <a href="http://clickontyler.com/blog/2009/01/forward-your-growl-notifications-to-twitter/">Growl notification plugin</a> that also twitters me when the download is complete.</p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/automatically-ichat-complete-transmission-downloads/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RailsTerm 0.3</title>
		<link>http://my-domain.se/railsterm-03/</link>
		<comments>http://my-domain.se/railsterm-03/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 10:36:59 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/?p=193</guid>
		<description><![CDATA[Just a quick note that RailsTerm, my AppleScript to automatically open the tabs (in OS X 10.5 Terminal) needed for Rails development), is bumped to version 0.3. Since I use Passenger (mod_rails) and Passenger.prefpane for my local development the script will now auto detect the virtual hosts available on your system (in /etc/apache2/passenger_pane_vhosts/*.vhost.conf). I use [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://my-domain.se/wordpress/wp-content/uploads/2009/03/console.jpg" alt="Terminal + RailsTerm" title="Terminal + RailsTerm" width="600" height="442" class="alignnone size-full wp-image-195" /></p>

<p>Just a quick note that RailsTerm, my AppleScript to automatically open the tabs (in OS X 10.5 Terminal) needed for Rails development), is bumped to version 0.3.</p>

<p>Since I use <a href="http://www.modrails.com/">Passenger</a> (mod_rails) and <a href="http://www.fngtps.com/passenger-preference-pane">Passenger.prefpane</a> for my local development the script will now auto detect the virtual hosts available on your system (in <code>/etc/apache2/passenger_pane_vhosts/*.vhost.conf</code>). I use the script daily and is a real time-saver for me.</p>

<p><a href='http://burnfield.com/martin/wordpress/wp-content/uploads/railsterm1.zip'>RailsTerm</a> or browse source is on <a href="http://github.com/haraldmartin/railsterm">GitHub</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/railsterm-03/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AppleScript to open iTerm tabs for Rails development</title>
		<link>http://my-domain.se/applescript-to-open-iterm-tabs-for-rails-development/</link>
		<comments>http://my-domain.se/applescript-to-open-iterm-tabs-for-rails-development/#comments</comments>
		<pubDate>Thu, 19 Jul 2007 10:53:40 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[iterm]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[terminal]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/2007/07/19/applescript-to-open-iterm-tabs-for-rails-development/</guid>
		<description><![CDATA[Update: This script is ported (and improved) to work with OSX Leopards&#8217; Terminal.app. I never really liked iTerm because of slow redrawing, ugly text anti aliasing and not reflowing text when resizing the window. After reading some interviews on a Rails site today and saw that a lot of people are using iTerm i wanted [...]]]></description>
			<content:encoded><![CDATA[<p>Update: <a href="http://burnfield.com/martin/2008/07/12/my-terminal-setup-for-rails-development/">This script is ported (and improved) to work with OSX Leopards&#8217; Terminal.app.</a></p>

<p><a href="http://www.flickr.com/photos/haraldmartin/850313291/"><img src="http://farm2.static.flickr.com/1021/850313291_b0fc5a1a29.jpg?v=0" alt=""></a></p>

<p>I never really liked <a href="http://iterm.sourceforge.net">iTerm</a> because of slow redrawing, ugly text anti aliasing and not reflowing text when resizing the window.</p>

<p>After reading some interviews on a Rails site today and saw that a lot of people are using iTerm i wanted to give one more try (because I&#8217;d really like a tabbed terminal).</p>

<p>It has improved a lot the latest months and seems really usable now. To make Rails development easier, I hacked together a small AppleScript what will ask you for the path to the Rails directory you want to use and then open four new tabs with Server/Mongrel, Console, Autotest and the directory itself. I thought it could be useful for others as well so here you go:</p>

<p>Save as an .app and run from Quicksilver:</p>

<pre><code>
global rails_dir

tell application "iTerm"
    activate
    set rails_dir to the text returned of (display dialog ¬
        "Please Enter the Path to Your Rails Directory" default answer ¬
        "~/Projects/" as text)

    if (count of terminal) = 0 then make new terminal

    my open_tab("Server", "&#038;&#038; ./script/server")
    my open_tab("Console", "&#038;&#038; ./script/console")
    my open_tab("Autotest", "&#038;&#038; autotest")
    my open_tab("Rails Directory", "")
end tell

on open_tab(title, command)
    tell application "iTerm" to tell first terminal
        launch session "Default"
        tell last session
            write text "cd " &#038; rails_dir &#038; command
            set name to title
        end tell
    end tell
end run_command
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/applescript-to-open-iterm-tabs-for-rails-development/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Autonamed dump/temp folder</title>
		<link>http://my-domain.se/autonamed-dump-folder/</link>
		<comments>http://my-domain.se/autonamed-dump-folder/#comments</comments>
		<pubDate>Thu, 06 Jul 2006 22:04:23 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/2006/07/07/autonamed-dump-folder/</guid>
		<description><![CDATA[To keep my desktop nice and clean I have a folder called &#8220;Dump&#8221; where I put temporary stuff like apps I want to try, PDF:s to read later that day or files I&#8217;m currently working with. But sometimes I forget to look inside that folder to find out what&#8217;s there so I wrote this Folder [...]]]></description>
			<content:encoded><![CDATA[<p>To keep my desktop nice and clean I have a folder called &#8220;Dump&#8221; where I put temporary stuff like apps I want to try, PDF:s to read later that day or files I&#8217;m currently working with. But sometimes I forget to look inside that folder to find out what&#8217;s there so I wrote this <a href="http://www.apple.com/applescript/folderactions">Folder Action</a> to let the folders name reflect the number of containing files/folders. (I know I could just enabled &#8220;Show item info&#8221; from Finders &#8220;View Options&#8221; but I don&#8217;t want to see all info for my hard drives and iPod)</p>

<p><img src="http://my-domain.se/wordpress/wp-content/uploads/2006/07/autonamed-dump-folder.png" alt="autonamed-dump-folder.png" class="centered" /></p>

<p>Just create a folder on your desktop, name it something like &#8220;Dump (temp)&#8221; and attach this Folder Action to it (Folder Actions need to be located in <code>~/Library/Scripts/Folder Actions</code>).</p>

<pre><code>-- Set item count as folder name.scpt
on adding folder items to this_folder
    my update_name(this_folder)
end adding folder items to

on removing folder items from this_folder
    my update_name(this_folder)
end removing folder items from

on update_name(this_folder)
    set this_name to POSIX path of this_folder
    set sh_script to do shell script "P=\"" &amp; (POSIX path of (path to me) as string) &amp; "\";echo ${P/%.scpt/.sh}"
    set new_name to do shell script "\"" &amp; sh_script &amp; "\" \"" &amp; this_name &amp; "\""
    tell application "Finder" to set name of this_folder to new_name
end update_name
</code></pre>

<p>The script needs a shell script to work (since I don&#8217;t like working with AppleScript that much). It should be named exacly as the AppleScript but with an <code>.sh</code> extension instead of <code>.scpt</code> and put in the same directory. Remember to make it executable (<code>chmod +x "Set item count as folder name.sh"</code>).</p>

<pre><code>#!/usr/bin/env bash
# Set item count as folder name.sh

# Since the folder has a custom icon and therefore a `Icon?` file I
# decrease the item count by 1. Bad solution but works for now.
NUM_ITEMS=`bc &lt;&lt;&lt; "$(ls "$1" | wc -l) - 1"`
if [[ $NUM_ITEMS == 0 ]]; then
    ITEMS="empty"
elif [[ $NUM_ITEMS == 1 ]]; then
    ITEMS="$NUM_ITEMS item"
else
    ITEMS="$NUM_ITEMS items"
fi
BASE=`ruby -e "puts %x(basename \"$1\").match(/(.+) \(/)"[1]`
echo "$BASE ($ITEMS)"
</code></pre>

<p>I first renamed the folder from the shell script but then Finder would visually move the folder one step down or left on the desktop for every update. Instead I just let the shell script generatr the new name and pass it back to the AppleScript that will rename the file as I want.</p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/autonamed-dump-folder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Colhour as iChat picture 2.0</title>
		<link>http://my-domain.se/colhour-as-ichat-picture-20/</link>
		<comments>http://my-domain.se/colhour-as-ichat-picture-20/#comments</comments>
		<pubDate>Fri, 28 Oct 2005 11:00:09 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[colhour]]></category>
		<category><![CDATA[ichat]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/wordpress/?p=18</guid>
		<description><![CDATA[This is the second version of the Colhour as iChat picture I posted the other day. The biggest improvment is that it will show both the hours and the minutes. There&#8217;re two versions of the script. The first one uses a Ruby script together with RMagick to create every image on the fly with the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://my-domain.se/wordpress/wp-content/uploads/colhourichat2.png" alt="" class="centered" /></p>

<p>This is the second version of the <a href="http://my-domain.se/ichat-picture-with-colhour/">Colhour as iChat picture</a> I posted the other day. The biggest improvment is that it will show both the hours and the minutes.</p>

<p>There&#8217;re two versions of the script. The first one uses a <a href="http://www.ruby-lang.org">Ruby</a> script together with <a href="http://rmagick.rubyforge.org/">RMagick</a> to create every image on the fly with the current time. But since it requires some installation of Ruby gems and other libraries, I decided to make a version with all  1440 images pregenerated (created with a small Ruby script of course) so you wont need to install the other libraries. The AppleScript still uses some Ruby, but it&#8217;s included in OS X, and should (at least) work on a basic OS X 10.4 Tiger installation. Let me know otherwise.</p>

<p>Instructions on how to set up a cron job to run the script every minute is in the <a href="http://my-domain.se/ichat-picture-with-colhour/">previous post</a>. Both the on-the-fly generated version (<code>update-gen.scpt</code>) and the pregenerated version (<code>update-pregen.scpt</code>) are included in the zip file.</p>

<p><a href="http://my-domain.se/wordpress/wp-content/uploads/colhour-ichat2.zip"><img src='/wordpress/wp-content/uploads/archive.png' alt="" class="centered" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/colhour-as-ichat-picture-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iChat picture with Colhour</title>
		<link>http://my-domain.se/ichat-picture-with-colhour/</link>
		<comments>http://my-domain.se/ichat-picture-with-colhour/#comments</comments>
		<pubDate>Mon, 24 Oct 2005 20:14:43 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[colhour]]></category>
		<category><![CDATA[ichat]]></category>
		<category><![CDATA[osx]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/wordpress/?p=17</guid>
		<description><![CDATA[This is a small AppleScript to update your iChat picture from the Colhour system that I have created with Peter. From the beginning I wanted to update it every second, but since it used 60% – 80% CPU, I decided to go with an update rate of once a minute instead. So you&#8217;ll only be [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://my-domain.se/wordpress/wp-content/uploads/colhourichatsshot_01.png" alt="" class="centered" /></p>

<p>This is a small <a href="http://www.apple.com/macosx/features/applescript/">AppleScript</a> to update your <a href="http://www.apple.com/macosx/features/ichat/">iChat</a> picture from the <a href="http://burnfield.com/peter/work/colhour">Colhour</a> system that I have created with <a href="http://burnfield.com/peter/work/information/">Peter</a>. From the beginning I wanted to update it every second, but since it used 60% – 80% CPU, I decided to go with an update rate of once a  minute instead. So you&#8217;ll only be able to se the current minute from the iChat picture.</p>

<p>To install:
<a href="http://burnfield.com/martin/wordpress/wp-content/uploads/colhour-ichat.zip">Download</a> and extract somewhere on your hard drive. Edit your <a href="http://en.wikipedia.org/wiki/Crontab">crontab</a> file manually or with an app like <a href="http://macupdate.com/info.php/id/7486">Cronnix</a> to run the script every minute. It should look something like this:</p>

<pre><code>*/1 *   *   *   *   YourUserName    osascript ~/path/to/update.scpt
</code></pre>

<p>I suppose I should do this in the &#8220;correct OS X Tiger&#8221; way by using <code>launchd</code> instead, but that&#8217;s for next time. As well as update it to show the the full date in different squares (without seconds due to CPU usage) like <a href="http://harald.net">the one on harald.net</a></p>

<p>Source included.</p>

<p><a href="http://my-domain.se/wordpress/wp-content/uploads/colhour-ichat.zip"><img src='/wordpress/wp-content/uploads/archive.png' alt="" class="centered" /></a></p>

<h3>Version 0.2</h3>

<p>Added a check in the script to see if iChat is running or not, so it wouldn&#8217;t launch iChat every minute.</p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/ichat-picture-with-colhour/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>E-mail subject cloud</title>
		<link>http://my-domain.se/e-mail-subject-cloud/</link>
		<comments>http://my-domain.se/e-mail-subject-cloud/#comments</comments>
		<pubDate>Fri, 12 Aug 2005 11:04:05 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[applescript]]></category>
		<category><![CDATA[projects]]></category>

		<guid isPermaLink="false">http://burnfield.com/martin/wordpress/?p=15</guid>
		<description><![CDATA[This is an attempt (and my first Apple Script) to generate an html-page using Peter Ström&#8217;s E-mail system. Everything could probably been done better etc but it works for now. Download here (source included)]]></description>
			<content:encoded><![CDATA[<p><img src='http://my-domain.se/wordpress/wp-content/uploads/emailsystem.png' class="centered" alt='' /></p>

<p>This is an attempt (and my first Apple Script) to generate an html-page using <a href="http://burnfield.com/peter/work/e-mail-system/">Peter Ström&#8217;s E-mail system</a>. Everything could probably been done better etc but it works for now.</p>

<p><a href="/wordpress/wp-content/uploads/emailsystem.zip">Download here</a> (source included)</p>
]]></content:encoded>
			<wfw:commentRss>http://my-domain.se/e-mail-subject-cloud/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
