Download hundreds (478 and counting) of AppleScripts for Apple's iTunes that will help make managing your digital music collection easier and more fun!
downloaded 2m 16s ago
Sort purchased tracks into discrete playlists by name or Apple ID
downloaded 4m 3s ago
Play through each track in a playlist at your set interval
downloaded 4m 12s ago
Perform search-and-replace on text in your choice of tags
downloaded 5m 49s ago
Change the iTunes "done" chime to a System sound, no sound, or your choice of an AIFF sound file
downloaded 8m 3s ago
Gather audio tracks whose files contain no artwork metadata
downloaded 8m 48s ago
Exports and then re-imports selected tracks' artwork
AppleScript is a simple Macintosh-only programming language that can control and automate actions on your Mac. AppleScript is already available on your computer as part of the Mac OS and many popular applications can be automated using AppleScript scripts. Scripts written for iTunes can manage files and track information, create playlists, interact with other applications, perform innovative tasks, and handle many kinds of chores which otherwise would be repetitive, laborious, and/or time-consuming.
Cool! Where Do I Start?
Start browsing the site by using the scripts ↓ Menu link above. AppleScripts are gathered into these general Categories:
- Managing Tracks
- Managing Track Info
- Managing Artwork
- Managing Playlists
- Controlling iTunes
- Exporting Info
Or use the search box at the top of every page to try and find something specific.
Not sure how to install AppleScripts? Here's a Download/Installation FAQ & Video.
Check back often or follow me on Twitter @dougscripts, my YouTube channel or on Facebook, or subscribe to my RSS blog feed and 30 Most Recent Scripts RSS feed to stay notified about new and updated scripts and info.
I wasn’t rooting for a Dark Mode, the new low-light display preference in macOS 10.14 Mojave. And after working in it I don’t particularly care for it. But I get that many people will find it compelling. So I’m guessing that there are a few “Dark Power” users who will expect that the scripts they download from this site will work in Dark Mode.
Well, they won’t. Not all yet, anyway. In order for AppleScript apps and scripts to respond to Dark Mode they have to be built in Mojave. Anything built in prior operating systems won’t know about Dark Mode. Now, other than updating the scripts just for Dark Mode, there aren’t enough compatibility issues that necessitates a script to be updated yet (new security features, notwithstanding). Most all have been testing fine under the macOS 10.14 betas. So, in my opinion, there’s no rush.
That said, there are some scripts and apps I will be updating for Mojave sooner than later, and these will include some of the more popular shareware apps and scripts. And then, eventually, as more scripts require regular maintenance they will be updated as a matter of course.
Most apps from this site are 1) saved as read-only to inhibit malicious code injection, 2) codesigned with my authorized developer ID so that they will break if they are so edited and 3) packaged in a disk image that is also codesigned with my developer ID so that the disk image will not open if its contents doesn’t check out. You—the user—also have Gatekeeper security options to allow just Mac App Store and/or developer signed apps.
Additionally, I would hope that my own personal reputation as a “good dude”, cultivated over almost twenty years as an AppleScript developer, would also attest to the safety of my scripts. But that won’t be the case for bad actors attempting to hijack processes on your Mac.
Apple is introducing a new level of security in Mojave called “AppleEvent Sandboxing”. It effects how AppleScript is or isn’t permitted to access certain locations and processes on your Mac.
When you launch an AppleScript of mine for the first time on macOS 10.14 Mojave you’ll see something like this:
This message will appear before the app or script starts runniing or it may appear a little later into the launch, if and when it actually attempts to access iTunes. AppleScripts that work with multiple apps will display an alert for each of those apps.
(Personally, I think that “OK” button should say “Allow”, but, whatevs.)
This is a new layer of protection that attempts to prevent AppleScripts, and other apps that use AppleScript, from controling apps and accessing data without you knowing about it. When you click “OK”, you’ve acknowledged to the system that you indeed intend to use the script with said application. Once so acknowledged, you shouldn’t see the dialog(s) again for that particular script.
Users of scripts that have targeted “System Events” may be familiar with this process when Accessibility requires a similar acknowledgement. This is a little different since it falls under the purview of Security & Privacy. In fact, if you go to System Preferences > Security & Privacy > Privacy > Automation, you will see the list of apps that use automation and which apps they target:
The list of apps on my machine is way longer than appear here.
If necessary, you can uncheck an app if you suspect the listed AppleScript is up to some funny business. Or, if you clicked on “Don’t Allow” when first asked, you can enable access for a particular app.
Felix Schwartz has posted some first looks at AppleEvent Sandboxing and it’s worth a read until Mojave is officially released and Apple tells us more.
I use three Airport Express base stations each hooked up to class-D amp/speakers so we can have music around the house. And this past week Apple—surprisingly—released a firmware update for these discontinued devices that gives them support for AirPlay 2. AirPlay 2 eliminates any audio latency between devices that may be playing simultaneiously (such as a pair of HomePods used in stereo). While this wasn’t much of a problem at my house before the update—minimal latency was detectable occasionally and wasn’t too distracting—I can attest that there is zero detectable latency now.
The Airport Express is a great option for creating an AirPlay audio network and you can still find them being sold as refurbs, used on eBay and elsewhere. They aren’t exactly using modern WiFi or security protocols, but if this isn’t an issue at your house it may be an inexpensive way to wirelessly extend your audio system.
The “Kitchen Express” on top of our refrigerator.
I’m happy to announce the release of Dupin v2.14, which adds a couple of navigation features I found myself wanting.
In case you don’t know, Dupin works with iTunes to discover, manage and even remove duplicate tracks and files. But Dupin allows you a way to establish exactly what properties of tracks make them duplicates and to choose which single track of a “Dupe Group” of tracks is the “Keeper” and which are the “non-Keeper(s)”. The latter Filtering can be done automatically or manually by scrolling through the Dupe Groups.
Dupin is available to try in Demo Mode, whereby some features are limited. A registration code to unlock the Demo Mode is $15.00.
Dupin turns eleven years old this year and wouldn’t have stayed alive so long without such a great group of users. So thanks!
Apple has released iTunes 12.8 (build 22.214.171.124). Other than initial support for AirPlay 2, I haven’t encountered any other significant changes. (ICYDK, the betas of macOS 10.14 install iTunes 12.9.)
Apple also released macOS 10.13.6 with AirPlay 2 support among the changes.
Apple has released the first Mojave beta for enrollees of its Public Beta program. Developers have had access to two versions of the beta to date.
Like most developers, I’ll be spending a lot of my Summer digging in to make sure my scripts and apps for iTunes are compatible and/or take advantage of new macOS features. And, as I caution around this time every year, if you are using the betas:
Don’t count on current scripts and apps having complete compatibility this early. In my nominal testing so far, I haven’t run into any serious issues with current versions of my software. But unless a script or app specifically states that it’s macOS 10.14 Mojave-compatible, assume that it isn’t—at least until the final release of Mojave later this year.
Early betas are simply not stable and can’t be depended on for “mission-critical” work. If a script or app doesn’t work like it used to it could be because the OS isn’t fully-baked yet.
Report a problem! The whole point of the beta program is to expose problems. It’s a good thing! If you have an issue with my software running under the Mojave beta, please let me know the details by emailing support AT dougscripts DOT com.
Thanks for your support and help!
M3Unify is a flexible file exporter and M3U playlist creator that will allow you to sensibly off-load copies of your iTunes songs to a user-chosen location—separate folder, external drive, USB thumb drive, SD card and so on—the way you and your audio player want.
M3Unify can archive playlists and audio files to a folder, volume or portable media and includes options to create Artist/Album sub-folders, rename files, convert to lossy formats, export album artwork, and more.
Watch the video demonstration.
M3Unify v1.10.0 adds these new features:
- Adds ability to open/drag-and-drop an M3U playlist file to “add” the accessible files it references
- Adds “Export M3U Using Relative Paths” option to create M3U playlist based on relative paths of files already in established locations
- Adds feature to remove duplicated entries
- Adds “Kind” column for better sorting of different audio types
- Adds option to show the Finder Information Window for a file
M3Unify is easy to configure and use. Try the nearly-full-featured demo for yourself. A license to make M3Unify fully-full-featured is $5.00. This update is free for registered users—who are the greatest!
I’m late with posting this, but, for the record, Apple released iTunes 12.7.5 (build 126.96.36.199) on May 29. Probably contains changes for AirPlay 2. And the usual app fixes and improvements.
Apple recently made a cool widget available for embedding Apple Music previews on websites. Such as:
The Apple Music Tools website allows you to search for an album and then generate an embed code that provides settings for various display options.
We’ve decided to use these links in the Show Notes for The Next Track podcast episodes; at the end of every episode, we pick an album we’re listening to and the Apple Music previews are a nice convenience.
The thing is, since we always use the same format for the iframe that is generated, it is only necessary to change the URL used in the embed code. Thus, we don’t have to visit the Tools website for each album. We can get the “Share Album” link in the iTunes app and just paste it into the iframe.
And this can be automated with AppleScript to a degree. Here’s a script that takes the album URL copied to the clipboard (after manually clicking “Copy Link”), prepares it properly (the share URL has a different sub-domain string than the one used in the embed code) and then places the full iframe text back into the clipboard so it can be pasted into our Show Notes template:
set sourceURL to the clipboard
set snippet to text ((offset of "apple.com" in sourceURL) + 9) through -1 of sourceURL
set the clipboard to ("<iframe allow=\"autoplay *; encrypted-media *;\" frameborder=\"0\" height=\"300\" sandbox=\"allow-forms allow-popups allow-same-origin allow-scripts allow-top-navigation-by-user-activation\" src=\"https://embed.music.apple.com" & snippet & "?app=music&at=11l6om\" width=\"660\"></iframe>
") as text
tell application "Safari" to activate
It brings Safari to the front after creating the iframe text because we edit the template in the browser.
If you use this, you may want to make sure you like the height, width, and other settings. If you edit the script, be sure to escape any double-quotes.
Sometimes it’s difficult to tell if a bug is really a bug or just a bizarre design decision. What I thought was a fixed bug might be the latter. The gist of this particular situation is that while you can select an individual Music track and change the Media Kind in its Show Info > Options panel to Music, Podcast, Audiobook or Voice Memo, you cannot select anything but Music on a batch selection. This post at Apple Discussions illustrates the issue with screenshots.
It is frequently desirable to change the Media Kind of Music tracks to Audiobook because these kinds of files are often imported as Music tracks. But unless you want to change each one individually there’s only a complicated workaround that apparently requires deleting and re-adding.
I did not try this workaround. Instead I wrote this AppleScript that changes the Media Kind of the selected tracks to Audiobook:
tell application "iTunes"
repeat with aTrack in selection
set media kind of aTrack to audiobook
A Correspondent alerted me to the issue and he tested this script out on a few batches of tracks without a problem (thanks again, Stephen).
To use the script: Open it in Script Editor by clicking the little script icon above. Save it named whatever you like with the Format “Script” (.scpt) in your ~/Library/iTunes/Scripts/ folder so that it will be listed in the iTunes Script menu. As usual with little scripts like this its often expedient to add a keyboard shortcut.