dougscripts.com

AppleScript

November 30 2012 - 10:49 am

Interesting play Issue with MiniPlayer

As I mentioned below, I had to fix a script to workaround a problem playing a playlist when only one track had as yet been copied to it, which prevented the rest of the subsequently added tracks from being recognized by MiniPlayer and Up Next; thus, only the first track would play. Similarly, if you were to play (the AppleScript command) any track in a playlist, the following tracks will not play because they haven't been recognized by MiniPlayer and Up Next ("No upcoming songs").

Doesn't go good when Mini Player is empty:

tell application "iTunes"

set aTrack to item 1 of selection

play aTrack

end tell

You can play the playlist and everything's OK. You just can't initiate play of the entire playlist by playing one of its tracks with AppleScript.

Goes good and loads in MiniPlayer:

tell application "iTunes"

set aPlaylist to view of front window

play aPlaylist

end tell

Additionally, I found that if the MiniPlayer was already loaded up with tracks, playing a track (via AppleScript) from anywhere would play that track and then resume with whatever is next in MiniPlayer.

November 30 2012 - 10:26 am

iTunes 11 Loses playlist window

Technically, you can't open a playlist in its own window in iTunes 11, so the playlist window element is moot.

November 29 2012 - 9:40 pm

iTunes 11 Loses Gapless Track Feature

You can no longer designate an album of tracks as gapless. Thus, a track's gapless property is now moot.

ERRATA: My title for this post is misleading. The gapless feature has not been lost. But the ability to manually change a track's gapless setting has been removed.

November 29 2012 - 2:37 pm

iTunes 11 Released

Apple has released iTunes 11. Apple originally previewed iTunes 11 at its September Special Event, announced a vague October release date, and then later postponed release to November.

This updated version features some iOS-inspired GUI changes, re-designed MiniPlayer, improved iCloud integration, improved search, and a revamped design of the iTunes Store.

August 21 2012 - 7:39 pm

Use TextExpander to Run iTunes AppleScripts

I was inspired by this recent article by Dr. Drang on using TextExpander to insert the URL of Safari's front document wherever you're entering text. There might be some benefits to being able to get current information in iTunes with a TextExpander AppleScript snippet or two. Or, as I describe below, three.

In case you don't know, TextExpander is a typing shortcut tool for the Mac whereby you enter a little abbreviated text and a predefined batch of text is inserted where you're typing. One of its amazing features is its ability to fire AppleScript snippets the same way. TextExpander can't accommodate hulking huge AppleScripts but it does allow for some pretty flexible 'scripting.

Before I get to the AppleScript part, here's how to set up TextExpander:
(more…)

August 8 2012 - 7:47 pm

AppleScript Save Changes in Mountain Lion

I've been meaning to post this for the record. Shane Stanley has written up How Mountain Lion Changes the Rules for AppleScript at TidBITS. He explains how scripts and AppleScript applications can be saved in an uncompiled state. If you distribute or system manage AppleScripts and develop on Mountain Lion you really should be aware of these changes.

May 13 2012 - 9:40 am

Project: Gather Partially Played Tracks

I got an email from Correspondent Sherwood Botsford asking if there was any way to round up his partially played audiobooks. What he wanted to do was maintain a playlist of recently added audiobook tracks that he hadn't finished listening to and sync it to his iPhone. He'd gotten the recently added stuff okay by using a Smart Playlist. But Smart Playlists don't include any criteria for detecting how far along a track has been played, and Last Skipped may not necessarily have been set if a track was simply stopped rather than skipped.

If a track's "Remember playback position" setting in its Get Info's Options tab has been checkmarked—presumably, your audiobooks are "bookmarkable" by default or you have set the "remember" option manually—a track's bookmark property will contain the number of seconds the track had been played before it was stopped. Thus, if any tracks have a bookmark value greater than zero then they've been partially played.

So here's a script that will gather all those partially played tracks into a new playlist named "Partially Played" and that playlist can be the source for the Smart Playlist:

(more…)

July 20 2011 - 10:36 am

Cocoa-AppleScript Applets/Droplets

Apple has given AppleScript Editor in Lion the ability to access Cocoa frameworks. In a nutshell, this means that AppleScript Editor can be used to create quite complex programs (which can run on Snow Leopoard and Lion only). But as far as I'm concerned, the big bonus is the ability to create single-window UIs for some of my AppleScripts. Instead of using two or three display dialogs or choose from list boxes, a single pane incorporating many options settings can be used. I've already created some of these kinds of interfaces in the form of helper apps that I bundle with a script. But now, I can make these UIs a part of the script bundle itself, without the need to launch additional helper apps. Plus: wicked fast.

Look for these sorts of scripts and updates to scripts coming soon.

November 18 2010 - 11:30 am

Just Play This Track and Stop Redux

For years many iTunes users and Correspondents have asked about a script that can just play the selected track and stop. Various methods using timers and delays and idle handlers were thrown at the challenge but nothing worked perfectly. But then: the iTunes Team quietly added a once parameter to the iTunes play command.

tell app "iTunes" to play item 1 of selection with once

Run that on a selected track and iTunes will play it once and then stop.

You know when they added it?

In iTunes 6!

Incredulous, I went back to my original write-up on iTunes 6 from October 2005. Whack! It was the only AppleScript change I even mentioned...and then promptly forgot about. I even managed at the time to write a Missing Menu Script using it.

In any case, all of this was precipitated by a posting at Mac OS X Hints awhile back, authored by fellow AppleScripter Laine Lee, which mentions the once parameter and just-play-once-and-stop trick.

I can't believe it took five years for me to rediscover it.

September 2 2010 - 12:03 pm

iTunes 10 Breakage (Nothing Serious)

Some AppleScripts from this site use a routine that checks for the version of iTunes you are running. Some of the scripts that use these routines are broken under iTunes 10. So when running a script with iTunes 10.0 you may run into a dialog that erroneously reports something like "This script requires iTunes 6.0.2 or better". This is not a bug in iTunes, but a problem with the way the script does the version check. (Long story short: the version number once was a number, but more modern versions of apps use a string. Thus "10.0" is not necessarily greater than "9.2.1" and the routine fails to accommodate this.) You can edit/comment out the version check routine yourself or wait until I get around to fixing the handful or so scripts that are affected. In that case, let me know if you see the error.

Site contents © 2001 - 2024 (that's right: 2001) Doug Adams and weblished by Doug Adams. Contact support AT dougscripts DOT com. About.
All rights reserved. Privacy.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc. This site has no direct affiliation with Apple, Inc.
The one who says "it cannot be done" should not be interrupting the one who is doing it.