Page 1 of 1

Eject iPod using LaunchBar

Posted: Mon Nov 27, 2006 12:59 am
by SpiralOcean
When I connect my iPod to the mac, it shows up in the mounted volumes. But as iTunes sync's with it, the iPod disappears from the mounted volumes? I am attempting to eject the iPod using launchbar but cannot figure out how to find it?

Any thoughts?

Posted: Mon Nov 27, 2006 5:05 am
by yanokwa
Have you tried using an applescript?

Code: Select all

tell application "iTunes" to eject "iPod Name"


is all that is needed. You can save it in your ~/Library/Scripts as "eject iPod" and have LB index that folder.

Posted: Tue Nov 28, 2006 2:02 am
by SpiralOcean
Dude! You Rock!

I seeing more and more reasons for AppleScript with LaunchBar!

Thanks for the script.

Posted: Sat Dec 02, 2006 7:01 am
by Jaharmi
It would still be cool to have this available by default within LaunchBar, rather than having to set it up.

Posted: Sun Dec 03, 2006 12:20 pm
by yanokwa
Looks like LB 4.2b1 has an Eject All option.

Posted: Mon Dec 04, 2006 7:11 pm
by Jaharmi
Is there a way to make the iPod name generic so that it will work for anyone's iPod, not just your own? Or work with different iPods if you have them attached to the same Mac?

Posted: Tue Dec 05, 2006 6:58 am
by yanokwa
http://www.apple.com/applescript/ipod/

Code: Select all

try
   display dialog "Eject iPod" & return & return & "This scirpt will attempt to eject the currently mounted iPod." buttons {"Cancel", "Continue"} default button 2
   
   -- check for iPods
   set the mounted_iPods to my locate_iPods()
   -- check for iPod count
   if the mounted_iPods is {} then
      error "No iPod is connected to this computer."
   else if the (count of the mounted_iPods) is greater than 1 then
      -- choose iPod
      set the ipod_names to {}
      repeat with i from 1 to the count of the mounted_iPods
         set this_iPod to item i of the mounted_iPods
         tell application "Finder"
            set the end of the ipod_names to the name of this_iPod
         end tell
      end repeat
      set this_name to (choose from list ipod_names with prompt "Pick the iPod to use:") as string
      if this_name is "false" then error number -128
      repeat with i from 1 to the count of the ipod_names
         if item i of the ipod_names is this_name then
            set this_iPod to item i of the mounted_iPods
            exit repeat
         end if
      end repeat
   else
      set this_iPod to item 1 of the mounted_iPods
   end if
   
   tell application "Finder"
      eject this_iPod
   end tell
   
   display dialog "The iPod has been ejected." buttons {"•"} default button 1 giving up after 2
on error error_message number the error_number
   if the error_number is not -128 then
      display dialog error_message buttons {"OK"} default button 1
   end if
end try

on locate_iPods()
   set the volumes_directory to "/Volumes/" as POSIX file as alias
   set the volume_names to list folder volumes_directory without invisibles
   set mounted_iPods to {}
   repeat with i from 1 to the count of volume_names
      try
         set this_name to item i of volume_names
         set this_disk to ("/Volumes/" & this_name & "/") as POSIX file as alias
         set these_items to list folder this_disk
         if "iPod_Control" is in these_items then
            set the end of the mounted_iPods to this_disk
         end if
      end try
   end repeat
   return mounted_iPods
end locate_iPods

use my ipod to play through an empty itunes on my work compu

Posted: Thu Oct 23, 2008 11:03 pm
by sabatina
Hi all, I have my ipod in synch with itunes on my home computer and all the songs are stored there. Is there a way to just use my ipod to play through an empty itunes on my work computer? I don't want to store the songs on my work computer, just to be able to listen to my ipod without headphones through my computer. I don't even necessarily need to use itunes, but I imagine you have to somehow. Any ideas?