Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
tell application "iTunes"
set foundCD to true
set myCD to some source whose kind is audio CD
on error errorMessage number errorNumber
-- error 1728 means the AudioCD was not found, so wait a little
if errorNumber is -1728 then
set foundCD to false
display dialog errorMessage
end if
end try
if foundCD then
set CDname to myCD's name
set myPlaylist to playlist 1 of myCD
set theTracks to tracks of myPlaylist
tell application "Max"
set mc to (count every track of document 1)
set maxdisk to document 1
end tell
set ic to (count theTracks)
if mc = ic then
repeat with i from 1 to (count theTracks)
set atrack to item i of theTracks
set ar to artist of atrack
set al to album of atrack
set tn to track number of atrack
set tc to track count of atrack
set ge to genre of atrack
set co to composer of atrack
set ye to year of atrack
set na to name of atrack
set comp to compilation of atrack
set com to comment of atrack
set dn to disc number of atrack
set dc to disc count of atrack
tell application "Max"
set maxtrack to track i of document 1
if not (rip in progress of maxtrack) and not (encode in progress of maxtrack) then
set title of maxtrack to na
set artist of maxtrack to ar
set date of maxtrack to ye as string
set genre of maxtrack to ge
set composer of maxtrack to co
--set number of maxtrack to tn
end if
end tell
if i = 1 then
tell application "Max"
set title of maxdisk to al
set artist of maxdisk to ar
set compilation of maxdisk to comp
set genre of maxdisk to ge
set date of maxdisk to ye as string
set composer of maxdisk to com
-- set track count of maxdisk to tc
-- max doesn't allow setting total tracks
set composer of maxdisk to co
if dn > 1 then
set disc number of maxdisk to dn
set total discs of maxdisk to dc
end if
end tell
end if
end repeat
display dialog "The iTunes CD track count and the Max CD track count do not match."
end if
display dialog "Couldn't get a CD from iTunes. Please retry."
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.