I'm running a terminal script and I would really like to send option choices to the OS X GUI, similar to how `choice.com` works for Windows / DOS, but a GUI version.

I know I can use applescript's `choose from list` command, but I would prefer a more native app because I think it would run quicker, as well as being more stable and more straight forward to interface with.

I have installed Platypus, and I like how it has the option to output data to a GUI window - but I would like the functionality of passing data back to the script from such a window.

One example scenario might be an easy way to select from a list of folders. This is what it looks like when I do it with Applescript:

![enter image description here](https://i.stack.imgur.com/FLi7h.png)

```
set listOfNames to {}
tell application "Finder"
    set filelist to every window
    repeat with currentFile in filelist
        set currentFileName to (POSIX path of (target of currentFile as alias)) as string
        copy currentFileName to the end of listOfNames
    end repeat
end tell
set mySelection to choose from list listOfNames

```

However, I would really prefer not to use Applescript.

### Resources

Until I can find (or build) the perfect app to do this, I might have to use Applescript. I'm going to list a few resources I've found:

A clever way to do multi-line applescript from the terminal:

Code [from here](http://forums.macnn.com/90/mac-os-x/160622/how-pass-parameter-terminal-applescript-osascript/):

```
#!/bin/sh
# filename: find_me 
# usage from Terminal prompt: find_me "Last First"

osascript -e "set the_name to \"$1\"" -e 'on find_me (the_name)
   tell application "Address Book"
     set the_people to every person
     repeat with this_name in the_people
          if name of this_name contains the_name then 
             set result to name of this_name & "\n" 
             repeat with e_info in emails of this_name
               set result to result & value of e_info & " "
             end repeat
               set result to result & "\n"
             repeat with p_info in phones of this_name
               set result to result & value of p_info & " "
             end repeat 
             return result
         end if
     end repeat
   end tell
end find_me' -e 'find_me(the_name)'

```

Also noteworthy from that page: "osascript does not yet provide any way to pass arguments to the script"

"But there is a workaround:"

```
call osascript -e 'set thename to '$1 -e 'load script "/path/to/script"' -e 'look_up_name(thename)'

```

And my contribution, a way to force the dialog to be in focus:

```
#!/bin/sh
osascript -e "set front_app_name to short name of (info for (path to frontmost application))
    set listOfNames to {"a", "b", "c"}
    tell application front_app_name to choose from list listOfNames"

```

It is also good to note that you can use multiple -e commands to pass multiple strings to be run.