Convert string to a list

OK, so here is my code:


do shell script "ls /Volumes/"
set _Result to the result

_Result returns the names of all the current mounted Volumes, like “Volume1 Volume2 Volume3”. What I need to do is to convert this string into a LIST compatible with the choose from list command. How would I do this? Thanks!


do shell script "ls /Volumes/"
set _Result to the paragraphs of result

or just set _Result to paragraphs of (do shell script “ls /Volumes/”)

That works BEAUTIFULLY. Thank you so much! Now one more thing:


do shell script "ls /Volumes/"
set _Result to the paragraphs of result
choose from list _Result

How would I use an if statement to find out what item was chosen? Thanks!

Try something like this:

tell application "System Events" to set diskList to name of disks

choose from list diskList
set theDisk to result
if result is false then error number -128 -- cancel
set theDisk to first item of theDisk

display dialog theDisk

Thanks that works :slight_smile: