Get One Item from List

I’m trying to determine if a volume is mounted for a script. I’m using “list disks” because I’m using this script in Tiger. List disks will return a list as a result. How can I look for a certain volume name in the list and then display a dialog if it exists?


Model: MacBook Pro
AppleScript: 2.1.2
Browser: Firefox 3.6.3
Operating System: Mac OS X (10.6)

This works for me in Tiger…

set all_disks to list disks
set my_disk to "Macintosh HD" -- replace "Macintosh HD" with target disk name
if my_disk is in all_disks then
	display dialog my_disk & " is Mounted!"
end if

Hope this helps.

set myList to {"A", "B", "C"}
set isThere to myList contains "A" --> true
set notThere to myList contains "D" --> false

andmr & Adam, thanks, both scripts work great!