I'm trying to have users pick a department from a list box. And then that choice is stored in a variable as string.

How can I do this?

I have code written like this:

set deptList to {"dept1", "dept2", "dept3", "dept4"}

set dept_name to {choose from my list deptList}

when I run the script, I get this error.

" doesn't understand the "choose" message". number -1708 from

Am I writing this code wrong?


You were close you had an errant 'my' which you do not need.

set deptList to {"dept1", "dept2", "dept3", "dept4"}

    set dept_name to {choose from list deptList}

Also you should pay attention to the colour code of the text. this will give you a clue as what the Applescript thinks the syntax is you have typed

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .