I am running into a issue where I need to have more then 3 options in a dialog box. I am generating a script that will merge ads based on which version they are. We have an upwards of 6 types of ads. Is there a way to have a dialog box display with more then 3 butons ? Any help is greatly appreciated.
Kris
No, but why not display a list of options to select from with the «choose from list» command?
set options to {"1", "2", "3", "4", "5", "6"}
choose from list options OK button name "Select" cancel button name "Cancel" with prompt "Please choose an option" without multiple selections allowed and empty selection allowed
set usrchoice to result
if usrchoice is not false then
set chosenoption to item 1 of (usrchoice as list)
end if
Or you could move your project to AppleScript Studio, which allows to create custom dialogs.
A form I often use, particularly when I want a choice made from a simple list, but want the choice to be the same item in a more complex list (names and paths, for example), I use this script:
set Cities to {"Boston", "New York City", "Wash. DC", "Miami", "Chicago", "Denver", "Houston", "San Francisco", "San Diego", "Seattle"}
set CtyCodes to {"BOS", "NYC", "DCA", "MIA", "ORD", "DEN", "IAH", "SFO", "SAN", "SEA"}
to getchosenItemNums(aList)
set numList to {}
set chosen to {}
-- Make a numbered list in "numList".
repeat with k from 1 to count aList
set end of numList to my leadingZeros(k) & ". " & item k of aList
end repeat
-- Offer a choice from the numbered list
set choices to choose from list numList with prompt "Hold the Command key down to make multiple choices." with multiple selections allowed
-- Extract the numbers only from the choices found in list "choices".
repeat with j from 1 to count choices
tell choices to set end of chosen to (text 1 thru ((my (offset of "." in item j)) - 1) of item j) as integer
end repeat
-- Return a list of item numbers
return chosen
end getchosenItemNums
set Codes to {}
repeat with aCode in getchosenItemNums(Cities)
set end of Codes to item aCode of CtyCodes
end repeat
on leadingZeros(n)
if n > 9 then
return n as string
else if n < 10 then
return "0" & n
end if
end leadingZeros