AppleScriptで choose from の値のインデックスを取得する
applescript - getting an index of a selected item in a list apple script - Stack Overflow
なんか、役に立たない回答ばかりだったので修正してみた
set cities to {"New York", "Portland", "Los Angelles", "San Francisco", "Sacramento", "Honolulu", "Jefferson City", "Olimpia"} set chooser to choose from list cities set item_index to -1 if chooser is not false then set chooser to contents of item 1 of chooser repeat with a from 1 to length of cities if item a of cities is equal to chooser then set item_index to a exit repeat end if end repeat end if display dialog item_index |
どうも、to choose from listから拾ってきた返り値は文字列じゃないらしく、単純比較すると全てfalseになってしまうのだった
Comments