Find CD & List Contents

This script will use Finder to get a Disk Named “CD” and get the contents for information. I have used this to rip audio, get artwork from picture CDs, or other forms of data from CDs.
These scripts are examples and should be changed to fit your usages.

OS version: OS X

--on idle 
 tell application "Finder" 
    -- Looks for a CD by an ejectable disk and the name "Audio CD" 
    set diskList to every disk whose (ejectable is true) 
 end tell 
 repeat with i in diskList 
    if the name of i contains "CD" then 
       set itsaCD to i 
       exit repeat 
    end if 
 end repeat 
 -- Displays if no CD 
 if itsaCD = "" then 
    display dialog "No CD in CD Player" 
    return 
 else 
    set eject_the_disk to false 
    if eject_the_disk is true then --Ejects Trouble CDS 
       tell application "Finder" 
          eject (every disk whose (ejectable is true)) 
          return 
       end tell 
    else 
       -- set the track list  
       set CDTrack_files to (every item of itsaCD) 
       set item_Count to (count of CDTrack_files) as string 
       set floopcount to 1 as real -- cycle through all inputs 
       repeat until floopcount > (count of CDTrack_files) 
          set aTrack to (item floopcount of CDTrack_files) as string 
          -- do stuff commands here 
          set trackInfo to info for aTrack 
           
          set floopcount to (floopcount + 1) 
       end repeat 
    end if 
 end if 
 --end idle

To eject a disk:
tell application "Finder" to eject (every disk whose name contains "CD")