-- swapGenreComposer.app -- 2006-07-28 Dong Hoon Van Uytsel, inspired on Doug Adams' iTunes scripts at http://www.dougscripts.com/itunes/scripts. -- Swaps Genre and Composer fields in selected track records. This allows browsing by composer, using iTunes' browse-by-genre feature. Save this script as a program in the :Library:iTunes:Scripts folder. -- It is presumed that the BPM (Beats Per Minute) field is not used by the user. If the respective fields are swapped, the BPM is divisible by swappedGenreComposerFlag. This prevents the script from swapping. property swappedGenreComposerFlag : 5 tell application "iTunes" if selection of front browser window is not {} then copy selection of front browser window to sel set x to (length of sel) set oldfi to fixed indexing set fixed indexing to true repeat with t from 1 to x tell contents of item t of sel if bpm is equal to 0 then set bpm to 1 end if if bpm mod swappedGenreComposerFlag ? 0 then set tmp to genre as text set genre to composer as text set composer to tmp set bpm to bpm * swappedGenreComposerFlag end if end tell end repeat set fixed indexing to oldfi else display dialog "No tracks have been selected." buttons {"Cancel"} default button 1 with icon 0 giving up after 30 end if end tell