Here is a selection of 75 Visual Basic scripts that I have written to be
used with iTunes for Windows.
The general method of use is to download a script (double-click or
right-click and use Download or Save As...) to a folder of your
choice, e.g. your Desktop, Downloads folder or create a folder at ...\iTunes\Scripts.
Select a playlist or highlight some tracks in
iTunes and then double-click on the script to execute it. If no specific tracks
are selected the script will try to work with all tracks in the current playlist
or sometimes the entire library.
Some scripts offer a choice of track by track confirmation of
changes or fully automatic processing of the selection. Many of the scripts can
optionally display a progress bar while running.
Download Link
|
Description |
|
AddDisc-TrackNumbers |
Adds leading track (& where
appropriate disc) numbers to the filenames of
selected tracks, unless already present.
(See
note #1 below) |
|
AddToTrackNumber |
Adds a value onto the track numbers of the selected tracks. Use, for example,
to add the track count from disc one onto each of the track numbers of disc two so that the
tracks are sequentially numbered across both discs.
Negative values can be used to undo an earlier
change. A new feature allows a second value to
be entered in the input to set
the total track count. This script is
particularly useful if you need to exceed a value of 999 in either
the track number or track count fields as such values cannot be entered in the
iTunes Get Info. dialog box.
N.b. At some point I hope to write an updated version to automatically sequence
or unsequence multiple discs. |
|
AddTrackNumbers |
Adds leading track numbers
(only) to the filenames of selected tracks,
unless already present.
(See note #1 below) |
|
AudiobookSortName |
Sets an alphabetically ordered
Sort Name for each selected
track or all tracks of the current playlist. Use
to work around the way that Apple devices order
audiobook tracks by track name instead of disc &
track number. See
Audiobooks on iPods for details. |
|
AutoSort |
Clears Sort Album, Sort AlbumArtist,
Sort Artist and Sort Name fields which begin
A/An/The to restore the AutoSort feature of iTunes
for selected tracks or all tracks in the current
playlist. See also UnAutoSort below. |
|
ChangeCategory |
Sets the category value for
selected podcast tracks. |
|
CheckFileCase |
Compares iTunes records of file locations and, if necessary, corrects
capitalization in file & folder names to ensure a case-sensitive correspondence.
Assumes capitalization of artist & album names is consistent. |
|
CleanDeadApps |
Cleans any orphaned files from the Mobile Applications folder if the apps are no
longer in your iTunes library or exist in newer versions. |
|
CleanDeadArt |
Cleans any orphaned artwork and/or empty folders left behind after iTunes or
other media managers have reorganised your files. |
|
ClearAlbumAutoRating |
Clears/prevents Album AutoRating by setting album rating to 1%.
Use ResetAlbumAutoRating to restore
AutoRatings. |
|
ClearBookmarks |
Clears the Bookmark Position of selected tracks or all tracks in the current playlist. |
|
ClearLyrics |
Clears the Lyrics of selected tracks or all tracks in the current playlist. |
|
ClearSkipCount |
Clears the Skip Count & Skipped Date of selected tracks or all tracks in the current playlist. |
|
ClearSortName |
Clears the Sort Name of selected tracks or all tracks in the current playlist.
Can be used to reverse the actions of
AudiobookSortName. See
Audiobooks on iPods for details. |
|
ClearTrackAutoRating |
Clears/prevents Track AutoRating by setting track rating to 1%.
Use ResetTrackAutoRating to restore
AutoRatings. |
|
ConsolidateByMoving |
Moves files to their new locations within the iTunes Media folder without creating copies.
The script is set up to use standard iTunes
naming rules, but can also be set to use full
length file & folder names or, if desired, could
be customised to rename files exactly as you
wish, e.g. move certain genres to their own
folders. You can also use this script to move
selected content to a media folder on a
different drive, e.g. to move movies or TV shows
to an external drive to free up space. |
|
ConsolidateByMovingLong |
As
ConsolidateByMoving but can generate file &
folder names longer than iTunes 40 character
limit and has different character substitutions
for characters that cannot be used in file
paths. |
|
CopyAlbumToAlbumArtist |
Copies values from the Album field to the
AlbumArtist field
of selected tracks or all tracks in the current
playlist. |
|
CopyArtistToAlbumArtist |
Copies values from the Artist field to the
AlbumArtist field
of selected tracks or all tracks in the current
playlist. |
|
ConvertFormat |
Converts selected files or the current playlist to the format used in
Edit > Preferences > General > Import Settings.
The newly converted files will replace the
originals inheriting ratings, play counts,
playlist membership etc. and the original files
will be sent to the recycle bin.
Backup first and use with caution
as these actions are not easily reversed if you
make a mistake. If present any Folder.jpg images
in the source folders will be added to tracks
that didn't previously have art, target format
permitting. |
|
CreateFolderArt |
Creates or updates Folder.jpg artwork images. If updating images then if at
least one track has art it will be embedded in any tracks from the same album
that are missing artwork or only have store downloaded art. |
|
DeDuper |
This script can remove all but one of any duplicated files. Play and skip counts from the duplicate entries are
merged and the remaining entry is updated with the most recent played and
skipped dates. The best rating and user playlist membership is also preserved. Before running select the Music source in your library, then
press down SHIFT and use File > Display Exact Duplicates to
restrict the files that need to be processed to potential candidates. If running
iTunes 11 use the ExactDuplicates script instead. Select the
resulting list of files before running the script. The script runs in four
phases, the first identifies logical duplicates, multiple references to the same physical files,
the second identifies distinct files with the same metadata and file size
(physical duplicates), the
third identifies files of different size with the same metadata (alternate
duplicates).
The final pass automatically removes all duplicates or optionally removes selected files from the
different classes of duplicates with the physically
duplicated files being placed
in the Recycle Bin just in case you find you want to restore them later.
For more details see
this thread
at Apple Support Communities.
WARNING Extreme caution should be
used with this script if your media is on Network Attached Storage. If there are
multiple potential paths to the same files and you have reimported the same
songs from alternate paths then files that are effectively logical dupes will be
treated as physical dupes. In this case the only physical copy of a file could
be deleted in error. Recovery of deleted files from NAS is non-trivial.
Please
backup your entire library
before using this script so that files could be replaced if necessary.
When dealing with duplicates of different size DeDuper
will preserve the largest as it is likely to be the best quality. If you want to
remove all but the smallest file use DeDupeKeepSmall. |
|
Duplicates |
Search selected tracks or the
entire library for duplicate tracks (same song
name) and if found add to a playlist called
Duplicates. Unlike
ExactDuplicates
this is rarely a useful subsection of the
library, and becomes less so with larger
libraries. With my library this list currently
matches almost a third of my library whereas
ExactDuplicates lists the 78 exact duplicates
that I've deliberately introduced for test
purposes.
Replaces the feature that was missing from iTunes 11.0 (but
very slow in comparison). Upgrade to iTunes
11.0.1 or later in preference. |
|
DuplicateSong&Artist |
Search selected tracks or the
entire library for tracks with the same song
name & artist and if found add to a playlist called
Duplicate Song & Artist.
This is a preliminary proof of concept for a
script designed to make sure a regular playlist
has only one copy of each song (defined as same
song name & artist so different covers, or
different songs with the same name, can still
appear). In contrast to
Duplicates this script matches about one
sixth of my library. |
|
EmbedFolderArt |
Embeds the largest image (by
area) stored in the same folder as each
processed track. Do not use if tracks from
different albums may be stored in the same
folder. Any "store downloaded" artwork is saved
as iTunesArt in the same folder
as the song and may be subsequently embedded if
it is the largest image. |
|
ExactDuplicates |
Search selected tracks or the
entire library for exact duplicate tracks (same
song name, album, artist, track no. & disc no.)
and if found add to a playlist called
Exact Duplicates. This script is
slightly more inclusive than iTunes own feature
as it matches disc <none> with disc 1.
Replaces the feature what was missing from iTunes 11.0 (but
very slow in comparison). The
resulting playlist is ideal as a source list for
the DeDuper script. |
|
ExportCSV |
Exports selected metadata as a
CSV text file suitable for import into Excel.
The current version exports multiple records for
each track that has multiple artwork, however
the artwork details can be omitted if not
required and the script could easily be adapted
to export additional information.
See this
thread at
Apple Support Communities for more details. |
|
ExportImport |
Exports or imports selected
metadata. Can be used to attempt to restore data
such as ratings, playcounts or genres from a
previous iTunes library file. To export data
first restore an older library, select the
tracks of interest, run the script to export.
Then restore the "current" database and drop the
output file onto the script to import. The
current version is set to export/import
playcounts but can be edited to bring forward
other data.
See this
thread at
Apple Support Communities for more details. |
|
FadeTunes |
Fades out iTunes over a predefined interval then stops. Use to have iTunes
slowly fade out as you drift off to sleep. You can edit the pre fade
duration, fade time, and min. volume to attain
on shutdown to your own preference. These are currently set to 1 min, 15mins and
0 respectively. |
|
FindTracks |
A script that attempts to locate missing tracks that have been misplaced within
your library, either as a result of a third party program reorganising the media
or as a result of attempting to move the library/media to a new location. Enter
the location of the media folder the files should be in and the script will try
to systematically fix every broken link. |
|
ForceForeground |
Display, and optionally change, the value of the iTunes ForceToForegroundOnDialog
state which governs whether iTunes will attempt to bring its dialog boxes to the
foreground. |
|
GaplessToPlaylist |
Scans selected tracks or the current playlist for Gapless tracks and, if found, adds them to a playlist called Gapless. |
|
GetInfo |
Test/demo script that provides a way to view a selection of track properties,
in particular those such as Bookmark Position that cannot be displayed in iTunes but can be accessed via the iTunes COM SDK. |
|
ImportFolderStructure |
Drag & drop an folder onto this script to import it into your iTunes library
and create nested playlist folders to show the structure of the imported files.
The same set of folders can be reimported as required when new content has been
added without generating
duplicates, although files that have been moved won't be removed from existing
playlists. |
|
ImportM3U |
Drag & drop an M3U playlist onto this script to import it into your iTunes
library. Created as a workaround to the M3U import bug with iTunes 10.4. Also
useful if you wish to import a playlist containing WMA files, or one that has
the same file at more than one location in the list. |
|
iTunesInfo |
Lists some library statistics and provides a way to view iTunes properties such as the state of the
Media Key Processing option that cannot be displayed in iTunes but can be accessed via the iTunes COM SDK. |
|
iTunesXMLPath |
A simple script that reveals the path to the active iTunes XML file. The active
<iTunes Library>.itl database will
be in the same folder. |
|
KeywordsToAlbum |
As KeywordsToComments, but changes are made to the
Album field. New words are appended and separated by a space. |
|
KeywordsToAlbumArtist |
As KeywordsToComments, but changes are made to the
AlbumArtist field. New words are appended and separated by a space. |
|
KeywordsToArtist |
As KeywordsToComments, but changes are made to the
Artist field.
To replace the current value of Artist by AlbumArtist,
for example, use the input:
-<Artist> <AlbumArtist>
To swap values use two related scripts and a field you don't
need as a temporary location or use/adapt one of the dedicated
SwapFieldField scripts below. |
|
KeywordsToComments |
Prompts for a keyword (or phrase) to add to the Comments field,
without removing what is already there or adding the same keyword twice. Prefix
a value with a dash to remove. Adds new comments on separate lines.
The following field tags will be replaced with their values: <Album>, <AlbumArtist>,
<Artist>, <Comment>,
<Composer>, <Genre>,
<Grouping>, <Location>, <Lyrics>, <Name>, <Year>.
You can also use \n to insert a new line where the field supports it. |
|
KeywordsToComposer |
As KeywordsToComments, but changes are made to the
Composer field. |
|
KeywordsToGrouping |
As KeywordsToComments, but changes are made to the
Grouping field. An advantage of using Grouping as opposed to Comments
for storing your keywords is that you can display all your different groupings
in the Column Browser and easily display any selection of them. This script
separates the keywords with a slash and sorts them alphabetically, but these options can be
changed if required. |
|
KeywordsToLyrics |
As KeywordsToComments, but changes are made to the
Lyrics field. Insert data into this field if you want to be able to
view it from the Lyrics tab during playback on an Apple device. By default this
script inserts new keywords before any existing text, separated by a new line,
and does not sort to preserve any lyrics that may already be there. |
|
KeywordsToName |
As KeywordsToComments, but changes are made to the
Name field. This script appends new keywords after the existing text, separated by a space and does not sort.
Use, for example, to append comments such as [Live] to every track in an album
or use
-(LIVE) [Live] to replace existing markup with your preferred text. |
|
KillEmptyPlaylists |
Removes empty playlists inadvertently created in the top level of the library.
Antidote to a bug in iTunes 10.4 that could cause empty m3u files to be created
if you attempted to add new tracks to your library by scanning the entire media
folder. I recommend using
iTunes Folder Watch for
the task of adding new tracks and removing orphaned entries. |
|
KillSelectedFiles |
Deletes selected files from iTunes and also deletes the underlying files whether they are inside the iTunes
Media folder or not. Files on local drives should be sent to the recycle bin,
files on network drives are deleted outright. Better be sure before you let this
one start work.
The current build won't handle iTunes Extras, iTunes LPs or video files that exist in both HD & SD versions properly,
however these are unlikely to be located outside of the iTunes Media folder so,
should the need arise, these can usually be disposed of in the normal way. |
|
KillTopLevelPlaylists |
Similar to KillEmptyPlaylists but kills all non-smart playlists
not in a playlist folder apart from Purchased and Voice Memos. Use to delete
redundant artist/album playlists that may have been created by third party
software and then imported into your iTunes library. Make sure to put any
non-smart playlists that you want to keep into a playlist folder before running
the script and have a backup of your iTunes Library.itl file
too, just in case. |
|
LastPlayedNever |
Unlike the built-in Reset plays command, this script also resets the
Last Played & Last Skipped dates to
Never, and resets any
stored Bookmark Position. |
|
LocaliseM3U |
Drag & drop an M3U playlist onto this script to change the absolute path references to pointers to files in the same
folder as the M3U file. Use to update a playlist exported from iTunes so that a
folder with the playlist and its files dragged out from iTunes can be used with
third party software or devices. |
|
MaximiTunes |
Maximizes the iTunes window, launching iTunes if not already open.
Does the reverse of
MinimiTunes but is unlikely to be of any use whatsoever... |
|
MediaKeyProcessing |
Display, and optionally change, the value of the iTunes AppCommandMessageProcessingEnabled
state, which governs whether iTunes will attempt to respond to keyboard media
key control requests such as Play, Pause, Next Track etc. |
|
MinimiTunes |
Minimizes the iTunes window, launching iTunes if not already open. Use as a start-up script to open iTunes
and minimize to the task bar so iTunes is available for Wi-Fi syncing. |
|
PlaylistsToFile |
Creates a text file containing the names of all the playlists in the iTunes
library, indented to show folder structure. |
|
RelativeM3U |
Drag & drop an M3U playlist onto this script to change the absolute path references to relative pointers to files in
artist & album folders below the folder containing the M3U file. |
|
ReplaceTextInAlbum |
Replaces instances of one set of characters with another. Call the script and enter your search and replacement text.
Surround the search and replacement text with spaces to ensure a match with
whole words. Use ''+ <search term> " to allow a match with the first word.
Replacing " The" with " the " changes "The Road to The Top" into "The Road to
the Top"
Replacing "+ The" with " the " changes "The Road to The Top" into "the Road to
the Top" |
|
ReplaceTextInAlbumArtist |
As ReplaceTextInAlbum, but changes are made to the AlbumArtist
field. |
|
ReplaceTextInArtist |
As ReplaceTextInAlbum, but changes are made to the Artist
field. |
|
ReplaceTextInName |
As ReplaceTextInAlbum, but changes are made to the Name
field. |
|
ResetAlbumAutoRating |
Restores normal Album AutoRating behaviour after using
ClearAlbumAutoRating. |
|
ResetTrackAutoRating |
Restores normal Track AutoRating behaviour after using
ClearTrackAutoRating. |
|
SortDateAdded |
Removes selected tracks from iTunes and then reimports them in reverse track
number order so that the tracks are in the correct order when viewing the
library in Date Added (descending) order. All volatile metadata (except Date & Added & Date Modified)
such as PlayCounts, Rating, Equaliser Preset etc. that isn't stored in tags is
preserved by the script which updates the reimported files with the data that
would normally be lost if you tried to do this task by hand.
The is an optional switch to reverse the order if you prefer to have things
arranged in Date Added (ascending) order. |
|
SortTrailingDigits |
Pads out any trailing digits from Name into Sort Name in order to achieve sensible sorting
for tracks with identical names apart from a trailing index number. The script
currently pads to 4 characters but can be edited if required. |
|
StripTrackNumbers |
Strips any leading track & disc numbers from the filenames of selected tracks.
(See note #1 below) |
|
SwapAlbumArtistAlbum |
Swaps values between the AlbumArtist & Album fields. |
|
SwapArtistAlbum |
Swaps values between the Artist & Album fields. |
|
SwapArtistAlbumArtist |
Swaps values between the Artist & AlbumArtist fields. |
|
SwapArtistName |
Swaps values between the Artist & Name fields. |
|
SyncStats |
Copies highest play count, skip count, rating and most recent played & skipped
date of selected tracks or playlist between iTunes and a manually managed iPod/iOS
device. Will attempt to match tracks first on LibraryIDs and if that fails on
tracks with the same tag information. |
TagFromFilename |
Attempts to parse the full file path for selected tracks in order to update the
values of
Album Artist, Album, Artist, Disc No., Track No, Track Title and
Compilation status. Also adds folder art if possible. Use to
construct track info. for .wav files or files that are missing tags but are set
out in conventional artist & album folders.
(See note #1 below) |
|
TagFromName |
Updates
Track No, Artist and Name from a track name in
<Track> - <Artist> - <Name> form. (Leading zeros and spaces around the
first dash are optional).
|
|
TrimName |
Trims a user-selected number of characters from the left or right of the name
field for selected tracks, useful for stripping unwanted track numbers from the
name field. |
|
UnAutoSort |
Sets Sort Album, Sort AlbumArtist,
Sort Artist and Sort Name fields which begin
A/An/Then to override the AutoSort feature of iTunes
for selected tracks or all tracks in the current
playlist. See also AutoSort above. |
|
Unconsolidated |
Searches selected tracks or the entire library for unconsolidated tracks and if
found creates a playlist containing them. Will also report if there are any dead
tracks. |
|
UpdateTagInfo |
Forces iTunes to compare each file's tag with
iTunes own record and updates iTunes if
necessary. Use to update iTunes after modifying
tags with 3rd party tools.
N.b. Previously this has been easy to achieve in
iTunes by selecting tracks, using Get Info., and
then clicking OK. As of iTunes build 9.2.0.25
this method appears not to update properly hence this
script. |
| |
|
Note #1
Media Organisation |
The scripts
AddDisc-TrackNumbers,
AddTrackNumbers,
StripTrackNumbers
& TagFromFilename,
which manipulate filenames,
may only be useful
if you disable the
advanced iTunes preference to Keep
iTunes Media folder organised or are
working with files stored outside of the
designated
iTunes Media folder. Otherwise, if iTunes is organising the files and
they are located inside the media folder, iTunes will simply undo
any changes made by these
scripts.
|
Note #2
Progress Bar |
Many of my scripts include the
provision of a progress bar. The script will do
its job quite effectively with or without a
progress bar but when processing large numbers
of files it is nice to be able to see that it is
still working and get an idea of how long it
will be before it finishes. Unfortunately the
code to create and control the progress bar uses
a feature of Windows where one program (my
script) is allowed to control another (an
instance of Internet Explorer). Security
features introduced in Windows Vista break this
method. I don't have the resources to develop or
purchase an alternative progress bar control
that is compatible with UAC so the easiest
approach, at least from my point of view, is to
detect if UAC is active and suggest that you
disable UAC if you want to see a progress bar
while running the script. You can reset UAC
later.
How to disable User Account Control |
| Windows Scripting Host |
If your browser opens the
scripts as text files return to the previous
page, right click on the link and click
Download... or Save As...
If the downloaded scripts open
as text files then you may need to install the
Windows Scripting Host:
Windows Script 5.7 for Windows XP |