I'm trying to make a preflight script to determine the best install location for my software. So far, the script finds all possible locations and stores them in an array (it's a bash script, BTW). Now what I need to do is prompt the user to choose from the list that's been assembled and then assign the selection to the correct variable. I'm assuming that will require osascript, but that's where I get lost. I know barely anything about Applescript, so I could use some help here:
Code:
osascript <<-EOF
tell application "Finder"
display dialog "Choose an install location: ...
# insert code
i=0
for file in ${list[@]}; do
echo ${list[i]}
let i++
done
# end code
... " default answer "1" buttons {"Continue"} default button 1
end tell
EOF
I know I could do this through a select statement, but I'd rather use the user-friendly Finder for this (that's the whole purpose of making this installer). Could someone give me an example of:
1) Some working osascript code, and
2) How I would capture the user's selection and interpret it?