<?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>Tyler Clemons &#187; appscript</title>
	<atom:link href="http://www.tylerclemons.com/tag/appscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tylerclemons.com</link>
	<description>tylerclemons.com</description>
	<lastBuildDate>Thu, 27 Oct 2011 17:06:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>iTunes Scripting with Python</title>
		<link>http://www.tylerclemons.com/itunes-scripting-with-python/</link>
		<comments>http://www.tylerclemons.com/itunes-scripting-with-python/#comments</comments>
		<pubDate>Fri, 29 Aug 2008 23:48:08 +0000</pubDate>
		<dc:creator>Tyler</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[appscript]]></category>
		<category><![CDATA[iTunes]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">http://tylershome.nfshost.com/?p=37</guid>
		<description><![CDATA[I ran across scripting for the Mac OSX awhile ago.  I finally decided to take a look at it when I decided to play around with Adium&#8217;s open source code.  The most dominant prescene I observed was Applescript.  Applescript is nice and all, but Python is nicer.  Scripting OSX applications with [...]]]></description>
			<content:encoded><![CDATA[<p>I ran across scripting for the Mac OSX awhile ago.  I finally decided to take a look at it when I decided to play around with Adium&#8217;s open source code.  The most dominant prescene I observed was Applescript.  Applescript is nice and all, but Python is nicer.  Scripting OSX applications with Python has been around for a bit.  Using the easy to install <a title="appscript" href="http://appscript.sourceforge.net/" target="_blank">appscript</a>, scripting can be leveraged by the power of Python and Ruby.</p>
<p><span id="more-17"></span></p>
<p>One of my favorite applications on my Mac is iTunes, so its no surprise this is the first application I turned to for testing.  To start, import the proper library:</p>
<div id="codebox" style="overflow: auto; "><code><span style="color: #ff6600;">from</span> appscript <span style="color: #ff6600;">import </span>*</code></div>
<p>Afterward, we can create a handle to iTunes and tell it to play:</p>
<div id="codebox" style="overflow: auto; "><code>itunes = app(<span style="color: #ff0000;">'itunes'</span>)<br />
itunes.play()</code></div>
<p>Running the above lines will open up the application called iTunes and execute the action play.  It will play the current track and specific tracks can be passed as an argument.  The action .stop() will stop iTunes.  Of course, we can do so much more with appscript.  For instance, we can create a playlist that only plays a specific album.  I wrote a script that does just that.</p>
<p>The script can be found <a title="iTunes Script" href="http://tylershome.nfshost.com/iTunesPlist.zip">HERE</a> in a zipped file.</p>
<p>It is documented and should be easy to follow.  One more thing, it is also possible to assign values to each track as if they were normal data objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tylerclemons.com/itunes-scripting-with-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

