Insert CD, Copy CD, Eject CD Script using AppleScript + Automator?

iTunes has this very useful feature where upon audio disc insertion it will import and eject.

Using Automator, I'd like to create a script or application that will copy a full data disc into a folder, then eject. I have the Automator Actions: Get Specified Finder Items, Copy Finder Items and Eject Disk all working, but I'm missing the initial step of Select CD. I believe this part needs an AppleScript.

Anyone know an easy script to select the CD upon insertion?

Posted on Feb 14, 2007 12:47 PM

Reply
6 replies

Feb 15, 2007 3:57 PM in response to John Franklin1

Okay, I'm back.

I'm writing a handy little application for you. I'll announce it in this thread when it's finished. (If I didn't have to eat and sleep, it might already be finished.) It watches for things which happen, and loads and executes scripts to match.

The events (with random capitalization):
Disk Mounted*
Disk Unmounted*, **
About To Sleep
Woke Up
Logout Requested *
Switched Back To This Account Via Fast User Switching
Switched Away From This Account Via Fast User Switching
Application About To Launch
Application Has Launched
Application Has Quit
Frontmost Application Has Changed

*I'm thinking of creating two events for these scripts. One if the disk path -- which is what the event from the OS tells my program -- is in "/Volumes/", which will give the name of the disk as well as the path, and one otherwise which will just give the path.

**At the present time, I am not trying to do the "disk is going to unmount soon" event. It's already risky enough handling "machine is about to sleep" since that has a cutoff of 30 seconds...

*This one is kind of a duplicate of existing stuff. You could just create a logout item for the script. But it was in the list of events that NSWorkspace generates, so I thought I'd toss it in.

It has custom handlers you write in your script, like you do for Mail filter scripts, and loads the scripts from a folder in the Application Support folder in your user's Library folder. It will look for specific scripts before general ones. For example, when the frontmost application has changed, it will first look for a script whose name (ignoring extensions) is the same as the application in a subfolder of its scripts folder. It will then look for a script named for the event. (I haven't decided on the final names for the events yet. I've been working on getting the guts of AppleScript to work from inside Cocoa instead. I have verified that I know how to do this properly, so it's just a matter of building the pretty user-friendly parts to support it.)

Oh, and you can tell it which events to watch for; these settings are persistent between launches, so you can set it as a startup item.

Feb 16, 2007 2:24 PM in response to Slappy White [new]

I have the first beta version available. I admit to not testing every one of the events. (I don't even have Fast User Switching enabled.) Anyone who wants to download it and help test is welcome. It's free anyway.

Error messages, when they appear, should show up in Console.app.

The events that I did test worked, so I doubt there are too many problems waiting in the wings.

And now I'm exhausted, so here's the URL and then I'm offline for a day or so:

http://www.beforetomorrow.com/Reactor1.0b1.dmg

There is documentation with the thing. The documentation would have been better, but between XCode deciding to trash my edited copy and Apple's documentation making a number of things harder than should have been necessary, I ran out of time.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Insert CD, Copy CD, Eject CD Script using AppleScript + Automator?

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