2

I want to automatically burn a cross-platform data CD with the same contents each time a blank disc is inserted, and eject it when done. To that end I created a very simple AppleScript that does just that:

do shell script "/bin/bash -c 'hdiutil burn ~/Desktop/catalog.iso'"

It works fine from the AppleScript editor. If I click "Run" with a blank CD inside, it burns the CD with the data from the .iso and ejects it upon completion.

However, if I select "Run ~/Desktop/burn.scpt" as the default action when inserting a blank CD, nothing happens. I actually have to open the AppleScript editor and select "Run". How can I make it actually run the script?

blank cd dialog

2 Answers 2

2

Open burn.scpt in the AppleScript Editor and save it as an Application. Then select burn.app as the desired action on CD popup.

4
  • That's a good idea, but it still doesn't work! If I insert the CD and then double-click the newly created Burn application it works, but it doesn't work if I auto-run it on insert. Commented Jan 21, 2012 at 5:49
  • Hmm. What version of the OS are you running? I'll try to replicate the problem.
    – Daniel
    Commented Jan 21, 2012 at 13:56
  • Running Mac OS 10.7.2 Commented Jan 21, 2012 at 18:33
  • 'Doh. Sorry, I can't replicate, because my machine running 10.7.2 doesn't have a CD drive. Maybe someone else can help here.
    – Daniel
    Commented Jan 21, 2012 at 23:34
0

You can use Keyboard Maestro to make a macro to run your shell script.

First make the macro with an 'Execute Shell Script' action like so: enter image description here

Then use start a new 'Script Editor.app' file and paste this:

tell application "Keyboard Maestro Engine"
    do script "Copy Disc"
end tell

^Note the name of the script above (Copy Disc) must correspond to the name of your macro in KM.

Next export with File > Export and use the File Format: Application. I recommend not code signing.

Only thing left is to make sure you set it: enter image description here

There's probably a more direct way to do it, but this works for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .