detecting ipods

how do i get a list of all the conneccted ipods and their names, then insert them into a dropdown list?

I wrote a very quick (rough ) script yesterday to get connected info.

found at http://www.oreillynet.com/mac/blog/2006/10/request_for_help_ipod_identity.html

But basically you can use system profiler and the com.apple.ipod plist to get your info.

but that doesnt detect ipods connect by USB

I do not have a USB ipod only firewire.

In terminal type : system_profiler SPUSBDataType

This may give you the info you need, then write the script around that if so.

To read more on system_profiler look at the man page for it.

how would i make it check for usb and firewire with the code that you wrote.

Give this a try:

set iPodList to {}

tell application "System Events" to repeat with thisDisk in every disk
	if folder "iPod_Control" of thisDisk exists then set end of iPodList to name of thisDisk
end repeat

return iPodList

Or the slightly faster:

set iPodList to {}

set diskList to list disks
repeat with thisDisk in diskList
	tell application "System Events" to if folder "iPod_Control" of disk thisDisk exists then ¬
		set end of iPodList to contents of thisDisk
end repeat

return iPodList

Qwerty, Nicely done…

wow, if i had thought of making it look for the iPOd_Control folder, i could have done this. cool, thansk a lot!

Apple had a pretty rigorous routine that I use regularly. You can pick it out from this “Eject iPod” script:

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

ok if i have a variable which contains a list of the connected ipods, how would i get them into a drop down list?