Eject iPod using LaunchBar

Sharing and discussing custom actions for LaunchBar
Post Reply
SpiralOcean
Posts: 19
Joined: Mon Nov 13, 2006 1:13 am

Eject iPod using LaunchBar

Post by SpiralOcean » Mon Nov 27, 2006 12:59 am

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?

yanokwa

Post by yanokwa » Mon Nov 27, 2006 5:05 am

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.

SpiralOcean
Posts: 19
Joined: Mon Nov 13, 2006 1:13 am

Post by SpiralOcean » Tue Nov 28, 2006 2:02 am

Dude! You Rock!

I seeing more and more reasons for AppleScript with LaunchBar!

Thanks for the script.

Jaharmi
Rank 2
Rank 2
Posts: 48
Joined: Sat Dec 02, 2006 6:50 am

Post by Jaharmi » Sat Dec 02, 2006 7:01 am

It would still be cool to have this available by default within LaunchBar, rather than having to set it up.

yanokwa
Posts: 17
Joined: Mon Nov 27, 2006 9:03 pm

Post by yanokwa » Sun Dec 03, 2006 12:20 pm

Looks like LB 4.2b1 has an Eject All option.

Jaharmi
Rank 2
Rank 2
Posts: 48
Joined: Sat Dec 02, 2006 6:50 am

Post by Jaharmi » Mon Dec 04, 2006 7:11 pm

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?

yanokwa
Posts: 17
Joined: Mon Nov 27, 2006 9:03 pm

Post by yanokwa » Tue Dec 05, 2006 6:58 am

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

sabatina
Posts: 1
Joined: Thu Oct 16, 2008 12:03 pm

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

Post by sabatina » Thu Oct 23, 2008 11:03 pm

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?

Post Reply