Apple - How do I make an AppleScript with a drop-down menu without Xcode?

One option would be to use CocoaDialog**:

set l to {"aa", "bb", "cc"}
set choices to ""
repeat with x in l
    set choices to choices & quoted form of x & " "
end repeat
set dialog to paragraphs of (do shell script "/Applications/CocoaDialog.app/Contents/MacOS/CocoaDialog" & " standard-dropdown --title title --text text --items " & choices)
if item 1 of dialog is "2" then return -- pressed cancel button
item ((item 2 of dialog) + 1) of l

You could also just use choose from list:

choose from list {"aa", "bb", "cc"} with title "Title" with prompt "Please choose" default items "bb" with multiple selections allowed


** The original URL for this Github repo by mstratman has changed. From research it seems CocoaDialog has transitioned to an org. Here are the new changes:

  • URL
  • Github
  • Repo pertaining to the previous answer

Tags:

Applescript