Why is the foo element not included?
items=( "invisible below" foo "invisible above" "bar" "foo" not invisible )
# invisible: ^
CocoaDialog standard-dropdown --text "Choose:" --items "${items[@]}" --string-output --float --debug
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The problem is that CocoaDialog loads the list of values into an array in which the keys and values are the same. It essentially sees foo and “foo” as them same item, the second one will overwrite the first – much like an array in PHP.
So, if you change your array to this:
You’ll see that foo1 shows up:
image http://img269.imageshack.us/img269/6738/screenshot20110818at223.png
The reason we know that it is CocoaDialog and not bash is that we can print out the array of items:
$ items=( "invisible below" foo "invisible above" "bar" "foo" not invisible ) $ printf "%s\n" "${items[@]}" invisible below foo invisible above bar foo not invisibleSo, the array that you’re passing is fine – CocoaDialog is just overwriting the first value with the second one.