1

I am hoping to create a custom applescript that will automatically eject my optical drive if the inserted cd is blank. I'm new to applescripts, and would greatly appreciate some input on how to find the answer.

I've currently created the array

set diskName to "disk2"
tell application "Finder"

end tell

where disk 2 is my optical drive... I've been able to eject the drive if any media is present, ive figured out how to mount the cd if any media is present, but I can not seem to figure out if it is even possible to index the media and then eject if no data is present.

Thanks in advance for any input or advice!


I believe I've figured out some sort of solution

set r to do shell script "/usr/bin/drutil status"

set diskName to "disk2"

if r contains "No Media Inserted" then

    do shell script "drutil tray eject"

end if

if r does not contain "No Media Inserted" then

    if r contains "blank" then

        do shell script "drutil tray eject"

    else

        tell application "iTunes" to activate

    end if

end if
ShooTerKo
  • 2,242
  • 1
  • 13
  • 18
zhwatts
  • 84
  • 1
  • 11

1 Answers1

0

I really don't see the point in this, all the time you are warned when you insert a blank disk.

McUsr
  • 1,400
  • 13
  • 10
  • the main purpose is to act as a helper to a secondary program. I'm using a disc picker, and a program to rip data from the discs, but the program does not have an auto-reject feature if the disk is blank or scratched. – zhwatts Mar 19 '15 at 15:34
  • Might I add, the auto-reject feature is important because the whole thing is working with a batch of discs... I don't want one bad disc to hinder the whole rendering process – zhwatts Mar 19 '15 at 15:41
  • I didn't understand you used a disc picker of sorts, I thought you manually inserted the discs into the tray, and then you should have been noticed. I am glad you figured out a solution! – McUsr Mar 19 '15 at 17:34