Is this possible? Help appreciated...

Any idea if it’s possible to have an applescript that generates a list of items to choose from based on the contents of a particular folder? For example;

set the_list to <contents of Users folder>

Is this possible?

If so, let’s say you select the_choice from the_list. Now, I need to paste the_choice into a shell script. Follow me?

Any ideas are appreciated.

You can get a selectable list of the items in a folder like this…

set filePath to choose folder
set thelist to list folder filePath
set theChosen to choose from list thelist OK button name "OK" with multiple selections allowed and empty selection allowed
if theChosen = false then return
do shell script "your_command " & theChosen

Be sure to leave a space after “your_command”.

I know that Greg knows this but for the sake of others, it might be necessary to add some extra code (quoted form of posix path) to make the paths acceptable to the shell.

– Rob

Actually, you’ve got to go even further because the choice from the list will be just the item name, not the full path and it will be a list, not a string so, putting it all together:

Jon

Thanks guys, I’ll see what I can do…