Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Eject audio disc when finished burning

As a follow up to my previous post, using Applescript I'm selecting some audio files in the Finder, importing them into iTunes, then burning a CD in one pass. I've tried adding, using Automator, a shell script at the end to eject the tray using


do shell script "drutil tray eject"



but the problem is the action wants to happen before the CD is finished burning and iTunes returns a no cd present error. Can anyone suggests a method to let the first action finish or a check to make sure there is a cd with data present before attempting to eject?


Tried below. No luck.


User uploaded file

OS X Mavericks (10.9)

Posted on Apr 4, 2016 7:42 AM

Reply
3 replies

Apr 4, 2016 10:31 AM in response to jarmen

There doesn't appear to be anything in iTunes dictionary related to the state of burning CDs, so there's no direct way to detect when it's finished.


It's been a while since I've burned a disk, but your best bet may be an indirect approach - does iTunes post a dialog/window showing the burn progress? If that's the case you could add a loop inside your initial script to detect when this window disappears - something like:


set doneBurning to false

repeat until doneBurning

if not (existswindow "Burning CD") then -- change the name to whatever is actually used

set doneBurning to true

end if


delay 5 -- wait a bit before checking again...

end repeat

It's crude, but it should work.

Apr 4, 2016 11:25 AM in response to Camelot

Thanks Camelot. It doesn't actually popup a burning window, but does it within the initial window with a dialog (see screenshot). I did notice that upon inserting a blank CD, nothing is mounted on the Desktop, but after the burn, the disc is mounted on the Desktop. Could the Finder be focused or checked in a loop until the disc is mounted, then ejected at that point?

User uploaded file

Eject audio disc when finished burning

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.