set optionList to {"dog", "cat", "hamster", "mouse", "budgerigar", "canary"}
set chosenPet to choose from list optionList with prompt "Choose a pet:"
if chosenPet is false then
error number -128 (* user cancelled *)
else
set chosenPet to chosenPet's item 1 (* extract choice from list *)
end if
display dialog "You chose a " & chosenPet & "!"
(For more details and options, check out the AS dictionary for the Standard Additions scripting addition.)
Im new to creating scripts for Apple (MacOsx Ventura)…
I would like to create an AppleScript with serveral buttons 3 to 9 depending on what Shell script I want to create… What I have now works in Mac terminal with selecting by pressing 1, 2, 3, etc… I like the look of Buttons… this method looks good so… but how to select the option and running a shell script or applescript after clicking ok
set optionList to {“Shell Script-1”, " Shell Script-2", " Applescript-1", " Applescript-2"}
set chosenScript tochoose from list optionList with prompt “Choose a Script to run:”
if chosenScript isfalsethen
error number -128 (* User cancelled *)
else
set chosenScript to chosenScript’s item 1 (* extract choice from list *)
endif
display dialog "You chose a " & chosenScript & “!”