<?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>Doug&#039;s AppleScripts for iTunes &#187; Missing Menu Commands</title>
	<atom:link href="http://dougscripts.com/itunes/category/missing-menu-commands/feed/" rel="self" type="application/rss+xml" />
	<link>http://dougscripts.com</link>
	<description>AppleScripts for iTunes</description>
	<lastBuildDate>Sun, 13 May 2012 13:40:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='dougscripts.com' port='80' path='/itunes/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Name New Playlist From Selection</title>
		<link>http://dougscripts.com/itunes/2011/10/name-new-playlist-from-selection/</link>
		<comments></comments>
		<pubDate>Wed, 26 Oct 2011 00:14:22 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[Controlling iTunes]]></category>
		<category><![CDATA[Managing Playlists]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=1394</guid>
		<description><![CDATA[I use the &#8220;New Playlist from Selection&#8221; command a lot to create temporary playlists. Actually, I use the Shift-Command-N shortcut more often than clicking the command in the File menu. But I&#8217;m irritated at all the dancing I have to do to name the new &#8220;untitled playlist&#8221;. It takes my attention away from what I [...]]]></description>
			<content:encoded><![CDATA[<p>I use the &#8220;New Playlist from Selection&#8221; command a lot to create temporary playlists. Actually, I use the Shift-Command-N shortcut more often than clicking the command in the File menu. But I&#8217;m irritated at all the dancing I have to do to name the new &#8220;untitled playlist&#8221;. It takes my attention away from what I was intending to do with the tracks. So, I rigged the script below to the <a href="http://dougscripts.com/itunes/itinfo/shortcutkeys.php">keyboard shortcut</a> Shift-Command-N&#8212;it works, luckily; sometimes assigning a shortcut that iTunes is already using doesn&#8217;t override the original command. The script does exactly what &#8220;New Playlist from Selection&#8221; does except now I can enter the name for the playlist <em>before</em> it&#8217;s created.</p>
<p><img src="http://dougscripts.com/itunes/pix/namenewplayistpic.png" /></p>
<p>Here&#8217;s the script:<br />
<span id="more-1394"></span></p>
<pre style="margin-bottom:1em;">
<b>tell</b> <span style="color:blue;">application</span> id "com.apple.iTunes"
	<b>try</b>
		<b>set</b> <span style="color:green;">sel</span> <b>to</b> <span style="color:purple;">selection</span>
		<b>if</b> <span style="color:green;">sel</span> <b>is</b> {} <b>then</b> <b>error</b>
		<b>set</b> <span style="color:green;">opt</span> <b>to</b> (<span style="color:blue;"><b>display</b></span> <span style="color:blue;"><b>dialog</b></span> "Make new playlist from selected tracks named:" <span style="color:blue;">default</span> <span style="color:blue;">answer</span> &#172;
			"" <span style="color:blue;">with</span> <span style="color:blue;">title</span> "Name New Playlist From Selection" <span style="color:blue;">with</span> <span style="color:blue;">icon</span> 1)
		<b>set</b> <span style="color:green;">newName</span> <b>to</b> (text returned <b>of</b> <span style="color:green;">opt</span>)
		<b>if</b> <span style="color:green;">newName</span> <b>is</b> "" <b>then</b> <b>error</b>
	<b>on</b> <b>error</b>
		<b>return</b>
	<b>end</b> <b>try</b>

	<b>set</b> <span style="color:green;">newPlaylist</span> <b>to</b> (<span style="color:blue;"><b>make</b></span> <span style="color:blue;">new</span> <span style="color:blue;">playlist</span> <span style="color:blue;">with</span> <span style="color:blue;">properties</span> {<span style="color:purple;">name</span>:<span style="color:green;">newName</span>})
	<b>repeat</b> <b>with</b> <span style="color:green;">t</span> <b>in</b> <span style="color:green;">sel</span>
		<b>try</b>
			<span style="color:blue;"><b>duplicate</b></span> <span style="color:green;">t</span> <span style="color:blue;">to</span> <span style="color:green;">newPlaylist</span>
		<b>end</b> <b>try</b>
	<b>end</b> <b>repeat</b>
	<span style="color:blue;"><b>reveal</b></span> <span style="color:green;">newPlaylist</span>
<b>end</b> <b>tell</b>

<a href="applescript://com.apple.scripteditor?action=new&#038;script=tell application id %22com%2Eapple%2EiTunes%22%0D%09try%0D%09%09set sel to selection%0D%09%09if sel is {} then error%0D%09%09set opt to %28display dialog %22Make new playlist from selected tracks named%3A%22 default answer %22%22 with title %22Name New Playlist From Selection%22 with icon 1%29%0D%09%09set newName to %28text returned of opt%29%0D%09%09if newName is %22%22 then error%0D%09on error%0D%09%09return%0D%09end try%0D%09%0D%09set newPlaylist to %28make new playlist with properties {name%3AnewName}%29%0D%09repeat with t in sel%0D%09%09try%0D%09%09%09duplicate t to newPlaylist%0D%09%09end try%0D%09end repeat%0D%09reveal newPlaylist%0Dend tell" title="Click to open in AppleScript Editor. Works via most modern Mac browsers."><img src="http://dougscripts.com/itunes/pix/clickscriptsmall.jpg" alt="" /></a>
</pre>
<p>I named it &#8220;Name New Playlist from Selection&#8221;, saved it to <em>~/Library/iTunes/Scripts/</em> and gave it the shortcut using <a href="http://dougscripts.com/itunes/itinfo/shortcutkeys.php">these instructions</a>.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Column Browser Go Home</title>
		<link>http://dougscripts.com/itunes/2011/09/column-browser-go-home/</link>
		<comments></comments>
		<pubDate>Wed, 28 Sep 2011 12:59:05 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[Controlling iTunes]]></category>
		<category><![CDATA[GUI Scripting]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=1366</guid>
		<description><![CDATA[I&#8217;ve found that iTunes&#8217; Column Browser feature is one of the best ways to navigate the Music library. But I&#8217;m often annoyed that I can&#8217;t easily  restore the browser window to a full view of tracks after digging down to a particular set of tracks. To do so requires a lot of scrolling up [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve found that iTunes&#8217; <a href="http://www.macworld.com/article/156388/2010/12/itunes_column_browser.html">Column Browser</a> feature is one of the best ways to navigate the Music library. But I&#8217;m often annoyed that I can&#8217;t easily  restore the browser window to a full view of tracks after digging down to a particular set of tracks. To do so requires a lot of scrolling up and clicking. Correspondent Josh Rafofsky emailed me complaining of the same frustration and his solution was pretty good: Command-B to Hide the Column Browser, fn-Left Arrow to got to the top of the browser, and the Command-B again to Show the Column Browser. But even this gets tiresome and he asked if there might be a one-step scripting solution.</p>
<p>You <em>know</em> there is.</p>
<p>I put together this script which uses a combination of standard AppleScripting and GUI Scripting to emulate Josh&#8217;s shortcuts solution:</p>
<pre style="margin-bottom:1em;">
<b>tell</b> <span style="color:blue;">application</span> "iTunes" <b>to</b> <span style="color:blue;"><b>activate</b></span>
<b>tell</b> <span style="color:blue;">application</span> "System Events"
	<span style="color:blue;"><b>key</b></span> <span style="color:blue;"><b>code</b></span> 11 <span style="color:blue;">using</span> command down
	<b>tell</b> <span style="color:blue;">application</span> "iTunes" <b>to</b> <span style="color:blue;"><b>reveal</b></span> <span style="color:blue;">track</span> 1 <b>of</b> (<b>get</b> <span style="color:purple;">view</span> <b>of</b> <b>front</b> <span style="color:blue;">window</span>)
	<span style="color:blue;"><b>key</b></span> <span style="color:blue;"><b>code</b></span> 0 <span style="color:blue;">using</span> {command down, shift down}
	<span style="color:blue;"><b>key</b></span> <span style="color:blue;"><b>code</b></span> 11 <span style="color:blue;">using</span> command down
<b>end</b> <b>tell</b>

<a href="applescript://com.apple.scripteditor?action=new&#038;script=tell application %22iTunes%22 to activate%0Dtell application %22System Events%22%0D%09key code 11 using command down%0D%09tell application %22iTunes%22 to reveal track 1 of %28get view of front window%29%0D%09key code 0 using {command down%2C shift down}%0D%09key code 11 using command down%0Dend tell" title="Click to open in AppleScript Editor. Works via most modern Mac browsers."><img src="http://dougscripts.com/itunes/pix/clickscriptsmall.jpg" alt="" /></a>
</pre>
<p>Save this as whatever you like&#8212;I call it &#8220;Column Browser Go Home&#8221;&#8212;save it to the <em>~/Library/iTunes/Scripts</em> folder, and assign it a <a href="http://dougscripts.com/itunes/itinfo/shortcutkeys.php">shortcut</a> (make sure you have enabled GUI Scripting, too, as outlined <a href="http://dougscripts.com/itunes/itinfo/keycodes.php">in this article on using key codes</a>). When launched after you&#8217;ve Column Browsed to a discrete set of tracks it will restore the entire list of tracks and jump to the top of the selected playlist. In my case this is usually the Music library playlist, but it will work with any playlist that&#8217;s being viewed with the Column Browser.</p>
<p>[UPDATE] And after all that, @tonyhazeldine tweets: &#8220;The same can be done by clicking on the column titles at the top of the column browser.&#8221; Yes, but <em>each column</em> has to be clicked.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Key Code Searching</title>
		<link>http://dougscripts.com/itunes/2011/09/key-code-searching/</link>
		<comments></comments>
		<pubDate>Sat, 10 Sep 2011 13:49:51 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[Controlling iTunes]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>
		<category><![CDATA[Tips and Info]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=1358</guid>
		<description><![CDATA[Here&#8217;s a snippet I&#8217;ve been using for awhile which I just got around to posting on the key codes page. I keep my iTunes Column Browser set with Artists and Albums listed On Left. Whenever I&#8217;m looking for a particular album I run this script to select the Music library and put focus on the [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a snippet I&#8217;ve been using for awhile which I just got around to posting on the <a href="http://dougscripts.com/itunes/itinfo/keycodes.php">key codes</a> page. I keep my iTunes Column Browser set with Artists and Albums listed On Left. Whenever I&#8217;m looking for a particular album I run this script to select the Music library and put focus on the Search box:</p>
<pre style="margin-bottom:1em;">
<b>tell</b> <span style="color:blue;">application</span> "iTunes"
	<span style="color:blue;"><b>activate</b></span>
	<span style="color:gray;">--</span> <span style="color:gray;">select</span> <span style="color:gray;">the</span> <span style="color:gray;">Music</span> <span style="color:gray;">library</span>
	<span style="color:blue;"><b>reveal</b></span> (<b>some</b> <span style="color:blue;">playlist</span> <b>whose</b> <span style="color:purple;">special</span> <span style="color:purple;">kind</span> <b>is</b> Music)
<b>end</b> <b>tell</b>
<b>tell</b> <span style="color:blue;">application</span> "System Events"
	<span style="color:gray;">--</span> <span style="color:gray;">bring</span> <span style="color:gray;">focus</span> <span style="color:gray;">to</span> <span style="color:gray;">Search</span> <span style="color:gray;">box</span> <span style="color:gray;">-</span> <span style="color:gray;">Command-Option-F</span>
	<span style="color:blue;"><b>key</b></span> <span style="color:blue;"><b>code</b></span> 3 <span style="color:blue;">using</span> {command down, option down}
<b>end</b> <b>tell</b>

<a href="applescript://com.apple.scripteditor?action=new&#038;script=tell application %22iTunes%22%0D%09activate%0D%09-- select the Music library%0D%09reveal %28some playlist whose special kind is Music%29%0Dend tell%0Dtell application %22System Events%22%0D%09-- bring focus to Search box - Command-Option-F%0D%09key code 3 using {command down%2C option down}%0Dend tell%0D" title="Click to open in AppleScript Editor. Works via most modern Mac browsers."><img src="http://dougscripts.com/itunes/pix/clickscriptsmall.jpg" alt="" /></a>
</pre>
<p>I&#8217;ve given it a <a href="http://dougscripts.com/itunes/itinfo/shortcutkeys.php">keyboard shortcut</a> of Command-Option-S.</p>
<p>More information on AppleScripting iTunes with key codes and keystrokes is <a href="http://dougscripts.com/itunes/itinfo/keycodes.php">here<a/>.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Missing Menu Script Updated</title>
		<link>http://dougscripts.com/itunes/2011/03/missing-menu-script-updated/</link>
		<comments></comments>
		<pubDate>Sun, 13 Mar 2011 20:10:17 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[Missing Menu Commands]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=1240</guid>
		<description><![CDATA[Search Results to New Playlist, a script in the Missing Menu Commands section, has been updated to fix a bug when trying to copy a &#8220;dead track&#8221; if one happened to turn up in the search results. Regrettably, &#8220;dead tracks&#8221;, those for which iTunes can find no corresponding file, cannot be copied between playlists and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://dougscripts.com/itunes/scripts/missingmenu.php#1027">Search Results to New Playlist</a>, a script in the <a href="http://dougscripts.com/itunes/scripts/missingmenu.php">Missing Menu Commands</a> section, has been updated to fix a bug when trying to copy a &#8220;dead track&#8221; if one happened to turn up in the search results. Regrettably, &#8220;dead tracks&#8221;, those for which iTunes can find no corresponding file, cannot be copied between playlists and this would cause the script to error out. Thanks to Correspondent Nicole St. Laurent for the heads-up.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Skip and Pretend We Played This Redux</title>
		<link>http://dougscripts.com/itunes/2011/02/skip-and-pretend-we-played-this-redux/</link>
		<comments></comments>
		<pubDate>Sat, 26 Feb 2011 15:49:14 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[Controlling iTunes]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=1216</guid>
		<description><![CDATA[A popular item on the Missing Menu Commands page is Skip and Pretend We Played This. If a song is playing that you don&#8217;t really want to hear, you&#8217;d launch this script to increase its play count by 1 (since it would not be increased until the track actually finished playing), set the last played [...]]]></description>
			<content:encoded><![CDATA[<p>A popular item on the <a href="http://dougscripts.com/itunes/scripts/missingmenu.php">Missing Menu Commands</a> page is <a href="http://dougscripts.com/itunes/scripts/missingmenu.php#1028">Skip and Pretend We Played This</a>. If a song is playing that you don&#8217;t really want to hear, you&#8217;d launch this script to increase its play count by 1 (since it would not be increased until the track actually finished playing), set the last played date to the current date and time (ditto), and play the next track. I use it in a live-updating Smart Playlist that, among other criteria, uses the last played date to only list songs not played in the past few weeks. This keeps any track I don&#8217;t want to hear from re-appearing for another few weeks. Ideally launched via shortcut, and so on.</p>
<p>But ANYway.</p>
<p>Correspondent Dirk Scharff noted that &#8220;if used in the first 2-20 seconds of the song the skip counter is increased too and that&#8217;s somewhat undesirable as this wouldn&#8217;t happen if I played that song.&#8221; I don&#8217;t pay much attention to skips at my house, but he has a point.  So Dirk submitted a mod to the script which I have incorporated below:</p>
<p><span id="more-1216"></span>The two lines that contain the <span style="color:green;font-family:monaco;">originalSkipCount</span> variable are Dirk&#8217;s mod:</p>
<pre style="margin-bottom:1em;">
<b>tell</b> <span style="color:blue;">application</span> "iTunes"
	<b>if</b> <span style="color:purple;">player</span> <span style="color:purple;">state</span> <b>is</b> <b>not</b> stopped <b>then</b>
		<b>try</b>
			<b>set</b> <span style="color:green;">theTrack</span> <b>to</b> <span style="color:purple;">current</span> <span style="color:purple;">track</span>
			<b>tell</b> <span style="color:green;">theTrack</span>
				<b>set</b> <span style="color:green;">originalSkipCount</span> <b>to</b> (<b>get</b> <span style="color:purple;">skipped</span> <span style="color:purple;">count</span>)
				<b>set</b> <span style="color:purple;">played</span> <span style="color:purple;">count</span> <b>to</b> (<b>get</b> <span style="color:purple;">played</span> <span style="color:purple;">count</span>) + 1
				<b>set</b> <span style="color:purple;">played</span> <span style="color:purple;">date</span> <b>to</b> (<b>get</b> <span style="color:blue;"><b>current</b></span> <span style="color:blue;"><b>date</b></span>)
			<b>end</b> <b>tell</b>
			<span style="color:blue;"><b>next</b></span> <span style="color:blue;"><b>track</b></span>
			<b>set</b> <span style="color:green;">theTrack's</span> <span style="color:purple;">skipped</span> <span style="color:purple;">count</span> <b>to</b> <span style="color:green;">originalSkipCount</span>
		<b>end</b> <b>try</b>
	<b>end</b> <b>if</b>
<b>end</b> <b>tell</b>

<a href="applescript://com.apple.scripteditor?action=new&#038;script=tell application %22iTunes%22%0D%09if player state is not stopped then%0D%09%09try%0D%09%09%09set theTrack to current track%0D%09%09%09tell theTrack%0D%09%09%09%09set originalSkipCount to %28get skipped count%29%0D%09%09%09%09set played count to %28get played count%29 %2B 1%0D%09%09%09%09set played date to %28get current date%29%0D%09%09%09end tell%0D%09%09%09next track%0D%09%09%09set theTrack%27s skipped count to originalSkipCount%0D%09%09end try%0D%09end if%0Dend tell" title="Click to open in AppleScript Editor. Works via most modern Mac browsers."><img src="http://dougscripts.com/itunes/pix/clickscriptsmall.jpg" alt="" /></a>
</pre>
<p>This will keep the skip count from increasing under any circumstance (when you run the script, that is; it doesn&#8217;t change iTunes&#8217; default skip-counting behavior). If you prefer that the skip counter behave normally you can just comment out or delete the two lines with <span style="color:green;font-family:monaco;">originalSkipCount</span>.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Re-Posting Stream Startup Script</title>
		<link>http://dougscripts.com/itunes/2009/08/re-posting-stream-startup-script/</link>
		<comments></comments>
		<pubDate>Tue, 11 Aug 2009 14:44:05 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Managing Tracks]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/wpfol/?p=22</guid>
		<description><![CDATA[A couple few days ago I posted a script here that would ping the Radio Paradise stream until its server accepted the connection, suppressing the error dialog that would appear when a connection was denied. Well, that was the wrong version of the script. Here is the correct version, and the one I fire up [...]]]></description>
			<content:encoded><![CDATA[<p>A couple few days ago I posted a script here that would ping the Radio Paradise stream until its server accepted the connection, suppressing the error dialog that would appear when a connection was denied. Well, that was the wrong version of the script. Here is the correct version, and the one I fire up every morning. You must select a radio stream track <em>first</em>, <em>then</em> run the script:</p>
<pre style="margin-bottom:1em;">
<b>tell</b> application "iTunes"
	<b>if</b> selection <b>is</b> {} <b>then</b> <b>return</b>
	<b>set</b> <span style="color:blue;">strm</span> <b>to</b> (item 1 <b>of</b> selection)
	<b>if</b> (<b>get</b> class <b>of</b> <span style="color:blue;">strm</span>) <b>is</b> <b>not</b> URL track <b>then</b> <b>return</b>
	<b>repeat</b>
		<b>try</b>
			play <span style="color:blue;">strm</span>
			<b>exit</b> <b>repeat</b>
		<b>on</b> <b>error</b> <span style="color:blue;">m</span> number <span style="color:blue;">n</span>
			delay 15
		<b>end</b> <b>try</b>
	<b>end</b> <b>repeat</b>
<b>end</b> <b>tell</b>

<a href="applescript://com.apple.scripteditor?action=new&#038;script=tell application %22iTunes%22%0D%09if selection is {} then return%0D%09set strm to %28item 1 of selection%29%0D%09if %28get class of strm%29 is not URL track then return%0D%09repeat%0D%09%09try%0D%09%09%09play strm%0D%09%09%09exit repeat%0D%09%09on error m number n%0D%09%09%09delay 15%0D%09%09end try%0D%09end repeat%0Dend tell" title="Open in Script Editor. Works via most modern Mac browsers."><img src="pix/clickscriptsmall.jpg" alt="" /></a>
</pre>
<p>The earlier script used the <strong>open location</strong> command, errors from which could not be defeated with the <strong>try</strong> block.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Missing Menu and Spare Parts Sections</title>
		<link>http://dougscripts.com/itunes/2009/04/missing-menu-and-spare-parts-sections/</link>
		<comments></comments>
		<pubDate>Thu, 09 Apr 2009 16:04:53 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>
		<category><![CDATA[Snippets]]></category>
		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/wpfol/?p=75</guid>
		<description><![CDATA[Some visitors may have noticed a few changes to the site&#8217;s formatting. The main challenge with a site like this is trying to make it easy to find something, but too many links were making every page more cluttered than it needed to be. So I got rid a lot of the links that cluttered [...]]]></description>
			<content:encoded><![CDATA[<p>Some visitors may have noticed a few changes to the site&#8217;s formatting. The main challenge with a site like this is trying to make it easy to find something, but too many links were making every page more cluttered than it needed to be. So I got rid a lot of the links that cluttered the left column; in fact, I got rid of the left column altogether. Most navigation can be done via the menu-like links in the header of each page.<br/><br/>I have tidied up the <a href="http://dougscripts.com/itunes/scripts/missingmenu.php">Missing Menu Commands page</a> and added a <a href="http://dougscripts.com/itunes/scripts/spareparts.php">Spare Parts page</a> that lists a few helpful iTunes AppleScript routines and handlers for script-makers. I&#8217;ll continue to add to this page.<br/><br/>Finally, I dislike the way Amazon MP3s sometimes download with &#8221; (Album Version)&#8221; at the end of their titles. Here&#8217;s a simple script, <a href="http://dougscripts.com/itunes/scripts/missingmenu.php#1064">Remove (Album Version)</a>, that will delete that text from the selected tracks.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
		<item>
		<title>Artificial Skip Counts/Skip Dates</title>
		<link>http://dougscripts.com/itunes/2008/12/artificial-skip-countsskip-dates/</link>
		<comments></comments>
		<pubDate>Tue, 30 Dec 2008 18:40:24 +0000</pubDate>
		<dc:creator>dougscripts</dc:creator>
				<category><![CDATA[AppleScript]]></category>
		<category><![CDATA[Missing Menu Commands]]></category>
		<category><![CDATA[Tips and Info]]></category>
		<category><![CDATA[iTunes]]></category>

		<guid isPermaLink="false">http://dougscripts.com/itunes/?p=149</guid>
		<description><![CDATA[Recently, Mac OS X Hints ran a hint about overcoming iTunes&#8217; criteria for increasing a track&#8217;s skipped count and skipped date via AppleScript. See, iTunes will only increase these properties if the track is advanced to another track during the first 2 to 20 seconds of play, and the hint tried to work around this [...]]]></description>
			<content:encoded><![CDATA[<p>Recently, Mac OS X Hints ran a <a target="_blank" href="http://www.macosxhints.com/article.php?story=20081217122646959">hint</a> about overcoming iTunes&#8217; criteria for increasing a track&#8217;s <b>skipped count</b> and <b>skipped date</b> via AppleScript. See, iTunes will only increase these properties if the track is advanced to another track during the first 2 to 20 seconds of play, and the hint tried to work around this so the skip properties could be increased anytime during play. Nothing personal, but I thought the OP at Mac OS X Hints kind of went overboard. <a href="http://dougscripts.com/itunes/scripts/missingmenu.php#skipcount">This script</a> on the <a href="http://dougscripts.com/itunes/scripts/missingmenu.php">Missing Menu Commands</a> page will get the job done without a lot of fuss.</p>
<hr/><small><a href="http://dougscripts.com/itunes/dougsupdated.rss" title="Take me to your reader">30 Most Recent RSS Feed</a> | <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Script Stats Page</a> by <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Name&op=y">Name</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Most Recent&op=y">Most Recent</a>, <a href="http://dougscripts.com/itunes/scripts/scriptcount.php?sortBy=Download Count&op=y">Download Count</a></small>]]></content:encoded>
			</item>
	</channel>
</rss>

