Mapping Eject Button

Discussion in 'Mac Programming' started by tjb1, Jan 1, 2011.

  1. tjb1 macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #1
    I have an external superdrive now and im trying to make the eject button eject it. I got KeyRemap4Macbook and I clicked the one that says "Eject to Command+Control+Option+Shift+E" which I assume means pressing Eject now activates the key sequence Command+Control+Option+Shift+E.

    I now made a Shell Script

    diskutil listdisk
    diskutil eject disk2(my superdrive)

    Problem now is I tried "Watch Me Do" and that doesnt work. I cant figure out how to make the script run when "Command+Control+Option+Shift+E" is pressed.

    Can anyone help with this??
     
  2. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #2
    I haven't tried this, but you could most probably use automator and the action, run shell script. Then save it as a service.

    Now go to system prefs/keyboard, chose services, and set the key combo you would like.
     
  3. tjb1 thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #3
    It is set as a service, I will remove "Watch Me Do" and try that.
     
  4. tjb1 thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #4
    I did that, but its not listed as a service in Finder. The shortcut itself doesnt work and the Eject button doesnt work.

    Its listed under Text in Services if that means anything...

    If I click on something and highlight the text, the shortcut ejects the cd but not the eject button.
     
  5. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #5
    Hm, that's odd. Most of my Services shows up under "Services/files and folders" in system preferences. But they are dealing with files and folders of course.

    But even the ones dealing with text like one called 'sort selected paragraph' lets me add a keyboard shortcut, by just double clicking it. Not sure how that would work though since it's dependent on a text selection to do it's work.
     
  6. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
    #6
    Wait, open your the service in Automator. What is your input method?

    I'm pretty sure it defaults to 'selected text from any program' or something of that nature. You have to change this to 'no input'.
     
  7. tjb1 thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #7
    The eject button now works to eject the external drive, thank you!

    Now is there anyway I can make this service only eject a cd/dvd drive?

    I see in diskutil eject it shows quite a few options for how/what to eject but I dont know how to apply those.
     
  8. tjb1 thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #8
    I think I found it by using "drutil eject" instead of "diskutil list and diskutil eject xxx" Testing this now with multiple devices plugged in and on restart.

    It works great, had a hub along with 4 flash drives plugged in and it ejected fine using drutil eject so now drive identification doesnt matter, it will just eject media drives.

    Thank you so much subsonix.
     
  9. subsonix macrumors 68040

    Joined:
    Feb 2, 2008
  10. tjb1 thread starter macrumors 68000

    Joined:
    Aug 26, 2010
    Location:
    Pennsylvania, USA
    #10

Share This Page