frontpage : here

Script FAQ & Solutions

Here are some of the most commonly asked questions I receive. Click on a topic to show or hide the answer.

Be sure to see frequently asked-for scripts on the Recommended by Task page.

Also see the Download FAQ + Video.

Please remember: This is not an iTunes Tips 'n' Hints site—it is an iTunes AppleScripts site. For more general help with iTunes, see Apple's iTunes Support Page and the iTunes Discussions board.

 

Can't get things going

• An older AppleScript 1) I just downloaded (or 2) I've been using forever doesn't work in Lion or later. It's icon is crossed-out in the Finder. Help!

It was probably written on a PowerPC machine a real while ago. Later scripts are usually Universal, meaning they can run on both PowerPC or Intel machines. The most modern scripts here are Intel-only and can only run on OS X 10.6 (Snow Leopard) and later.

First, see if there is an updated version of the script(s) you are using. Otherwise, you can convert a PPC script to run on your Intel machine yourself:

  1. First, make a note of the file extension of the particular AppleScript. This is important. It will be "scpt", "scptd", or "app".
  2. Now, launch AppleScript Editor (located in the /Applications/Utilities/ folder). Click on "Open..." in its "File" menu and navigate to the file of the AppleScript, select it and click the "Open" button. It will open in AppleScript Editor.
  3. Click on "Save As..." in the File menu. If the extension you made a note of a moment ago is "scpt" or "scptd", set the "File Format" popup to "Script". If the extension is ".app" then set it to "Application". Make sure "Run Only", "Show Startup", and "Stay Open" are un-checked (in some rare cases a file with an .app extension may need to be "Stay Open"; check if the code contains a section that begins with "on idle"; if so, checkmark "Stay Open").
  4. Click the "Save" button and quit AppleScript Editor.

Now that the script has been saved using your machine's native platform, it will run correctly.

| Show all answers | Hide all answers | top |

• After upgrading to Lion (or later) from Snow Leopard (or earlier), I can't find my installed AppleScripts. What happened?

I have always instructed users to install AppleScripts in the [username]/Library/iTunes/Scripts/ folder--also known as the user Library folder or ~/Library. However, the [username]/Library/ folder is hidden by default in Lion (this is a new feature). To make the [username]/Library/ visible temporarily, hold the Option key and click the Finder's "Go" menu. Select "Library" from the drop down menu that appears. Other options are described here and in Macworld's article 18 ways to deal with the hidden Library folder in Lion.

Installing AppleScripts in the [username]/Library/iTunes/Scripts/ folder makes scripts available for the current user only. But you can also install scripts in the (still visible) [startup disk]/Library/iTunes/Scripts/ folder--also known as the local Library folder or just /Library. They will display in the iTunes Script menu as usual, and also be available to all users on your machine. I suspect that when Lion users can't find the user Library folder that they install scripts in the local Library, and then wonder where all the older scripts are.

| Show all answers | Hide all answers | top |

• Your instructions say to install scripts in my Library folder, but I don't have one!

By default, the user "Library" folder as of OS X 10.7 (Lion) is hidden. To temporarily make it visible to install your scripts, Option-click on the Finder's "Go" menu and select "Library" from the drop-down menu. This will reveal the ~/Library/ folder. After you close it it will be hidden again. Here are 18 ways to deal with the hidden Library folder in Lion put together by Dan Frakes at Macworld.

| Show all answers | Hide all answers | top |

• I followed the instructions for creating a "Scripts" folder in my username > Library > iTunes folder. However AppleScripts don't show up in the iTunes Script menu when I place them in the scripts folder. What am I doing wrong?

1- Make sure the folder in your username > Library > iTunes folder is called "Scripts". Make sure there are actual AppleScripts inside of it.

2- If you are creating the folder for the first time you may need to quit and restart iTunes; you may even need to 1) log out and log in, or 2) restart your computer. This is not typically necessary so there may be other issues at play.

Once the Script menu appears in iTunes, AppleScripts will appear immediately once you add them to the folder.

| Show all answers | Hide all answers | top |

• I need to run QuickTime Player 7 in Lion or later. What can I do?

Download QuickTime Player 7.6.6 for Mac OS X 10.6.3. Do not download QuickTime Player 7.6.9! Chris Breen of Macworld has more details here.

| Show all answers | Hide all answers | top |

• When I try to override Gatekeeper settings I get an OSStatus error.

Some scripts from this site when downloaded to OS X 10.8 may not pass Gatekeeper Security when set to the "Mac App Store or Developer ID" setting (the default Gatekeeper setting). To over-ride Gatekeeper settings, Control-click/Right-click the script in the Finder and choose Open from the contextual menu, then allow the script to be opened.

However, for a small number of scripts, even this may not work. You may see an OSStatus error message and the script will still be unable to run.

It appears to occur with a few .app scripts, but not all.

I'll try to catch these scripts (and if you run into one, let me know) and update them. In the meantime, the fix is to temporarily lower your Gatekeeper Security settings to allow apps from anywhere to launch. Once the script is launched, you can restore your Gatekeeper settings.

| Show all answers | Hide all answers | top |

• I downloaded a script and when I launch it the system reports that it is damaged and that I should move it to the Trash.

Sorry about that. A few script downloads that were prepared before OS X 10.9 may elicit this message. There's nothing you can do except let me know about it so I can repackage the download.

| Show all answers | Hide all answers | top |

 

Is this possible?

• How can I change the "Date Added" or "Release Date" of some of my tracks?

You can't:



The date added and release date properties of track are read-only (r/o) and cannot be manipulated by AppleScript or any simple means I am aware of. iTunes manages these dates internally. If tracks are re-added iTunes will update date added.

| Show all answers | Hide all answers | top |

• I'd like to know how many times a song played, say, in the past week/month/year. Possible?

In order for something like this to be possible, iTunes would have to associate a date with each play of the track. It doesn't do this (its database would explode in size in no time if it did). iTunes only keeps track of the last date a song was played.

| Show all answers | Hide all answers | top |

• Is there any way to change the MPAA ratings tags of my video tracks?

iTunes has no AppleScript track property for this rating information. The only way to change this is to find it in the file's meta-data, change it, and re-write it back to the file. AppleScript is ill-suited for this. You may want to try using MetaX, a free meta-data editor for MP4 and QuickTime movie files.

| Show all answers | Hide all answers | top |

• I'd like to be able to create Smart Playlists with AppleScript. Any help?

Unfortunately, there is no way to access any Smart Playlist criteria with AppleScript. Of course, the playlist class properties of a Smart Playlist, such as name, duration, shuffle, and so on, are scriptable like regular playlists.

| Show all answers | Hide all answers | top |

• How can I change the pitch of a track with AppleScript?

It has to be done using QuickTime Player 7. QuickTime Player X does not have the capability. Download QuickTime Player 7.6.6 for Mac OS X 10.6.3. Do not download QuickTime Player 7.6.9! Chris Breen of Macworld has more details here.

The script Change Pitch of Song will use QuickTime to change the pitch of the selected iTunes track.

| Show all answers | Hide all answers | top |

• I'd like to schedule app downloads, manage apps, sort my apps by account ID.

Apps, their meta-data, and the App Store are inaccessible to AppleScript.

| Show all answers | Hide all answers | top |

• I need to clear the SOMETHING tag of a lot of tracks...

No AppleScript required. Let's say you want to clear the BPM tag in every track in your Music library. Select the Music library and then click Command-A to select all the tracks. Press Command-I and confirm that you want to edit the information for multiple tracks. In the "Info" tab of the Multiple Item Information window that appears make sure the BPM text field is empty and put a checkmark in the checkbox next to it. Don't change anything else! Now click the OK button. In a few moments, the BPM tag of all the selected tracks will be cleared.

| Show all answers | Hide all answers | top |

 

iTunes issues

• I seem to have a lot of duplicates...

Check out Dupin or Dupin Lite.

| Show all answers | Hide all answers | top |

• I deleted a lot of audio files...now I have a lot of tracks labeled with "!". Any easy way to get rid of them?

Your database is filled with "dead" tracks. These are tracks which, for any of various reasons, have become disassociated from their files. iTunes still has the track entry in its database but has “lost” the path to the file. It is possible that the files are no longer on the local drive, or are inaccessible because the external drive on which they are stored is not mounted, or have been loaded via CD. They display a "!" in the playlist. List MIAs will create a text file listing any information that is retrievable from missing tracks. If you want to remove the dead tracks see TrackSift.

If the files are located on an external drive, try re-mounting the drive.

However, in some rare cases, these dead tracks' files really are available but iTunes fails to recognize their location. You can either double-click these tracks and let iTunes assist you in re-locating them, or use a script like iTunes Track CPR which attempts to locate dead tracks in your iTunes Library folder using the Artist and Album names. IMHO, trying to reunite tracks with errant files using AppleScript is cumbersome at best. See the next Q below

| Show all answers | Hide all answers | top |

• Wait a sec! I didn't delete any files, but I still see "!" next to some tracks. What gives?

Some users report that their files are intact, yet on occasion, some files go AWOL...they still exist, but for some reason iTunes can't see them, and the tracks they represent show the "!". This can happen, for example, if files are located on an external drive which has not been mounted before iTunes is launched, among other reasons. You can use List MIA's, which will create a list of these tracks; then you can go hunting for them. To re-associate these tracks, you must click on them; iTunes will ask if you want to locate the missing file, and you weave through an Open/Save dialog for each one.

I have often been confronted with: "But my files are right there! Can't you write a script that just looks for the files in the iTunes Media folder?" It's not as easy as that. To prove my point, I put together iTunes Track CPR. It uses the extant data from a "dead track" to try and locate its file in the iTunes Media folder. Then it deletes the existing dead track, re-adds the found file, and applies the old track’s data to the newly added track. It is far from a perfect solution and I wouldn’t rely on it.

| Show all answers | Hide all answers | top |

• Where does iTunes store artwork?

Artwork downloaded from the Store is stored in the "Album Artwork" folder in ~/Music/iTunes/ folder. The files are encrypted and cannot be accessed as normal graphics files.

| Show all answers | Hide all answers | top |

• How can I access the shared tracks on the iTunes of other machines on my network? For instance, I want to copy a shared track from my remote desktop to my local laptop.

iTunes own Home Sharing feature is pretty good under most circumstances. But if you want to be able to manipulate files, tracks and playlists on another machine you are going to have to do some work. I have posted a project that describes some networking techniques using AppleScript and a variety of other tools.

| Show all answers | Hide all answers | top |

• I deleted a bunch of tracks but I didn’t Trash the files. So the files are still in my iTunes Media folder. How can I locate them?

The applet Music Folder Files Not Added will list the file paths of the files in your designated "iTunes Media" folder which are not in iTunes' library. Additionally, you can select a different parent folder and its contents will be compared to the iTunes library. Includes options to Add a selection of found files to iTunes, move them to the Trash, and export to a text file.

| Show all answers | Hide all answers | top |

• iTunes stops updating my podcast subscriptions after a while. How can I make sure my podcasts are always updated?

iTunes will stop updating a podcast if you have not listened to at least one of its episodes in five days. Update Expired Podcasts will batch-update every podcast subscription so you don't have to manually update each one individually.

I have also posted instructions on how to create a launchd agent to run this script automatically and invisibly in the background to ensure that your podcasts are always updated.

| Show all answers | Hide all answers | top |

 

AppleScript problems/errors

• I downloaded an older script which doesn't seem compatible with Lion (or later). Will it be updated?

Let me know about it and I’ll see what I can do. But I probably won’t be updating it.

However, you can convert a PPC-era script to run on your Intel machine yourself:

  1. First, make a note of the file extension of the particular AppleScript. This is important. It will be "scpt", "scptd", or "app".
  2. Now, launch AppleScript Editor (located in the /Applications/Utilities/ folder). Click on "Open..." in its "File" menu and navigate to the file of the AppleScript, select it and click the "Open" button. It will open in AppleScript Editor.
  3. Click on "Save As..." in the File menu. If the extension you made a note of a moment ago is "scpt" or "scptd", set the "File Format" popup to "Script". If the extension is ".app" then set it to "Application". Make sure "Run Only", "Show Startup", and "Stay Open" are un-checked (in some rare cases a file with an .app extension may need to be "Stay Open"; check if the code contains a section that begins with "on idle"; if so, checkmark "Stay Open").
  4. Click the "Save" button and quit AppleScript Editor.

Now that the script has been saved using your machine's native platform, it will run correctly.

| Show all answers | Hide all answers | top |

• How can I get rid of the Startup Screen that asks me to Run or Quit the script?

First of all, I never save scripts using the "Startup Screen" option. Nevertheless, for some reason, the Startup Screen will display by default. I suspect it has something to do with how Leopard handles AppleScripts created in Tiger and before. To prevent the Startup Screen from ever showing again, you must open the script with AppleScript Editor and re-save it with "Save As..." making sure to uncheck the "Startup Screen" option in Script Editor's Save panel. Also, it is very important to make certain that the script's original "File Format" is used; don't save a compiled Script as an Application, and visa versa. Make a note if an Application needs to "Stay-Open".

| Show all answers | Hide all answers | top |

• A script seems to work for a little while and then I get a parameter error. What does that mean?

A parameter error can indicate that some property a track was expected to be available but wasn't. For example, a script that looks for a track's file may get a parameter error if the track is "dead"; that is, it has no associated file. If working with a selection of tracks, see if there is anything different about one or more of the tracks.

| Show all answers | Hide all answers | top |

 

Just wondering

• Where are the AppleScripts for the Windows version of iTunes?

Sorry, Charlie! AppleScript is Macintosh-only. However, I am trying to keep an up-to-date list of Windows resources. Email me with your info.

(AppleScripts are not like JavaScripts or Perl scripts and cannot be opened in a text editor. AppleScripts can only be created or opened on a Macintosh computer with Script Editor or other AppleScript-writing software.)

| Show all answers | Hide all answers | top |

• I require an AppleScript for a particular project. Unfortunately, I know nothing about AppleScript. Can you help me out?

Please realise that I receive many, many, many requests like this week in and week out. Thanks for asking, but unless your idea is useful for a wide audience of users, the answer is most likely no. There are plenty of resources available on this site as well as hundreds of scripts to learn from. Have a crack at writing your own. If you have a question in that regard I may be able to assist.

| Show all answers | Hide all answers | top |

• How do you use AppleScript with key codes?

I’ve written a short article on using keystrokes and key codes with AppleScript.

| Show all answers | Hide all answers | top |

Site contents © 2001 - 2014 Doug Adams and weblished by Doug Adams, dougscripts AT mac DOT com. About.
All rights reserved. Legal.
AppleScript, iTunes, iPod, iPad, and iPhone are registered trademarks of Apple Inc.