Tips and Info
System Events Error and the Fix
It can happen that Accessibility permissions you have previously given an applet are lost. In such a case, you may see this message:
System Events got an error: 'Some Applet' is not allowed assistive access. (-1719).
Here's how to fix it.
1) Quit the applet
2) Open System Preferences > Security & Privacy > Privacy and click on Accessibility in the left sidebar.
3) Look for the name of the applet in the list. If it's checked, UN-check it, wait a moment* and then check it again. Launch the applet.
(*I cannot emphasize enough how important it is to WAIT. It may appear as though your clicks are not working. Just wait.)
4) If this does not work: quit the applet. Go back to Accessibility in System Preferences.
5) Use the minus button to remove the applet from the list.
6) Launch the applet. Eventually it will appear again in the Accessibility list. Make sure it gets check marked.
7) If this does not work: quit the applet. Delete the applet from the list as in 5) but this time drag the applet from the Finder into the list. Go to 6).
One of these methods will eventually work. It's a fragile thing for some reason.
Toggle Views Via Keyboard Shortcut
I'm re-posting/reconstituting this tip with a more obvious title because I can never find it to forward to a Correspondent whenever I'm searching for it on my own website!
* * *
Correspondent David K. turned me on to this trick, which I had never seen before:
As you may know, you can assign Keyboard Shortcuts to application menu commands in System Preferences > Keyboard > Shortcuts. Conventionally, you would select the name of the app, the name of the menu command, and a keyboard shortcut combination in this preference tab. What I didn't know is that you can designate the precise menu heirarchy for a command by entering something like Top Menu->Submenu->Command, with "->" between each menu title, instead of just the name of the command.
The reason I want to do this in iTunes is that I'd like to set a shortcut for the "Songs" playlist view. But, because the word "Songs" is also in the Controls > Shuffle submenu, simply entering "Songs" in the keyboard shortcut panel would invariably toggle the Shuffle Songs option.
But by entering View->View As->Songs, the keyboard shortcut knows I mean that "Songs" and not the Controls > Shuffle > Songs.
Hoy!
Then I did the same for Playlist view:
The shortcuts also appear adjacent to the commands in their menu.
And an AppleScript could probably fire the shortcut via System Events.
UPDATE for The Music app: These instructions are pretty much the same except you will note that the names of the menu items in the View menu are "as Songs" and "as Playlist". Thus, use View->as Songs, View->as Playlist .
No AppleScript Necessary
AppleScript is great for performing tasks that can be aggravatingly repetitive for humans (Mac-using humans, anyway). However, it is not always the best solution to a perceived problem with tag editing in iTunes.
It seems to me that some users are ignoring (or are perhaps anxious about using) several built-in features of iTunes that makes tag editing relatively fast and simple.
Multiple Item Editing - I am always surprised that even seasoned iTunes users don't know about this which has been available since iTunes was Sound Jam. Select two or more tracks and choose "Get Info" from the iTunes Edit menu (or press Command-I). Unless you've turned the warning off, a dialog will appear that asks if you're sure you want to edit multiple items. Yes! Press the "Edit Items" button. An Info window will appear that is similar to the Info window for a single track except it will not contain single-track specific tags, like Name-related tags.
Smart playlists - Creating temporary Smart playlists is the fastest way to assemble a batch of tracks that have similar attributes. Use them liberally. Select all the tracks that have been assembled (Command-A to Select All) and multi-edit them. You don't have to keep a Smart playlist around when you're done editing the tracks it contains. In fact, at my house I consider all playlists semi-temporary. On the other hand, keeping a live-updating Smart playlist around for track tags you occasionally want to edit (say for converting track ratings to some loved or disliked equivalent) is a good idea, too.
The Column Browser - The Column Browser is another feature that allows you to select only certain tracks by Album, Artist, Genre, Composer and (kinda strangely) Grouping while in Songs or a List view. With the Column Browser visible (Command-B, or View > Column Browser > Show Column Browser), click a particular Genre, for example, and only the tracks with that Genre will appear in the browser window. Press Command-A to select all of those tracks and do the multi-edit. The Select All does not, as you may fear, select all of the library tracks, only those displayed in the browser window by virtue of what's chosen in the Column Browser.
No disrespectin', but it sometimes seems to me that some users are trying to create a set-in-stone just-so library (emulating bookshelves of pristinely ordered CDs or LPs?) and are reluctant to use some of these techniques because things'll get messed up. But the tools available in a digital media library actually make it very easy to quickly access anything at any time. Give in to their power.
Assign Keyboard Shortcuts to Avoid Ambiguity
Correspondent David K. turned me on to this trick, which I had never seen before:
As you may know, you can assign Keyboard Shortcuts to application menu commands in System Preferences > Keyboard > Shortcuts. Conventionally, you would select the name of the app, the name of the menu command, and a keyboard shortcut combination in this preference tab. What I didn't know is that you can designate the precise menu heirarchy for a command by entering something like Top Menu->Submenu->Command, with "->" between each menu title, instead of just the name of the command.
The reason I want to do this in iTunes is that I'd like to set a shortcut for the "Songs" playlist view. But, because the word "Songs" is also in the Controls > Shuffle submenu, simply entering "Songs" in the keyboard shortcut panel would invariably toggle the Shuffle Songs option.
But by entering View->View As->Songs, the keyboard shortcut knows I mean that "Songs" and not the Controls > Shuffle > Songs.
Hoy!
Then I did the same for Playlist view:
The shortcuts also appear adjacent to the commands in their menu.
And an AppleScript could probably fire the shortcut via System Events.
UPDATE for The Music app: These instructions are pretty much the same except you will note that the names of the menu items in the View menu are "as Songs" and "as Playlist". Thus, use View->as Songs, View->as Playlist.
UPDATE for Ventura: As of macOS 13 Ventura, simply enter "as Songs" and "as Playlist".
Check For Library Corruption With xmllint
A Correspondent recently reported that a script which needed to read the current "iTunes Library.xml" file was failing. This XML file, as you may know, is exported periodically by iTunes and is pretty much an abridged output of the actual iTunes database. Even the XML file exported by iTunes' File > Library > Export Library... command was unable to be read. This suggested that there might be some corruption in the track entries, (I recently had a similar report and that database contained corruption that prevented the XML from being exported; the user reported that the XML had last been updated in 2012.)
iTunes can seem to behave normally even if there are tracks with corrupted track entry data or corrupted metadata in their files. So you might not even be aware of corruption until a third-party appliance elicits errors.
There is a command-line tool called xmllint that can find some corruption in the "iTunes Library.xml". You can run it from Terminal, or in a script like this:
set f to choose file
set rez to (do shell script "xmllint --valid --noout " & quoted form of POSIX path of (f as text))
This will error when it finds some badly encoded or improper UTF-8 text, which is often the culprit. Then it's just a matter of finding the troublesome tracks in iTunes and fixing the problems if possible. Usually this means just editing the tags in iTunes.
Genius Playlists Can Be Shuffled
So I just discovered that everytime I play a Genius playlist it plays in the same order. My guess is that everybody else already knew that.
Today, however, I discovered that if you place a Genius playlist inside a Playlist Folder and then select the Playlist Folder, set it to shuffle, and then play, the songs play shuffled. That is, the tracks play in a different random order each time the Playlist Folder containing the Genius playlist is played.
When I told Kirk McElhearn about this he imagined that one could create several Genius Playlists based on the same Artist seed in order to maximize variety. So I tried that. And here's what's cool:
My presumption was that two (or more) Genius Playlists based on a similar seed each might contain duplicate tracks which would therefore be duplicated in the Playlist Folder that I put them in. But they are not. While the two Genius Playlists show 100 songs each, the total of tracks for the Playlist Folder is 174; the duplicate tracks don't "register" in the Playlist Folder context.
I like this because I can maintain the Genius playlists longer without having to refresh or recreate them.
UPDATED: This Tag That Tag v3.4
This Tag That Tag v3.4 will assist with swapping, copying, and appending data between two user-chosen tags in selected tracks or tracks in the selected playlist:
Swap - swap data between tags, ex: ARTIST<->COMPOSER
Copy - copy data from one to another tag, ex: ARTIST->COMPOSER ARTIST
Append - append data from one tag to the end of another, ex: ARTIST->COMPOSER - ARTIST
Prepend - prepend data from one tag to the beginning of another, ex: ARTIST->ARTIST - COMPOSER
The latter three actions also provide an option to delete the info from the first tag after the copy.
This latest version adds "Category", "Description" and "Episode ID" text tags as options and a few minor tweaks and adjustments.
More info and download is here.
Search for Scripts from the Help Menu
I may have known this. But I guess I forgot about it. So I was pleasantly surprised when I found you can type the first few letters of a script you want to use (that is installed in ~/Library/iTunes/Scripts/ so that it appears in the iTunes Script menu) in the Search box in iTunes Help menu. These scripts are seen as menu items, so any script containing the entered text will show in the "Menu-Items" result. Then, if you hover the mouse over the script's name, the actual Script menu pops up with the script highlighted and that hovering blue arrow pointing at it:
Make Ringable at iPhone Ticker
German iPhone site iPhone Ticker posted a nice article and You Tube video describing how to use my free Make Ringable script to create ringtones from your iTunes tracks.