Hello
If you have only two buttons, you may try something like the following CODE 1 (for ApplesScript 1.10 or later). It will allow you to select button "B" by enter/return key and button "A" by escape key. (Note that you cannot make the cancel button the default button in this method.)
--CODE 1
return choose2("Choose A or B.", {"A", "B"}, 2)
on choose2(t, {a, b}, i)
(*
string t: dialogue text
string a, b: button names
integer i: default button's index in {a, b}
return string: name of button selected
* enter/return key invokes button i and escape key invokes another
*)
try
display dialog t buttons {a, b} default button i cancel button (i mod 2 + 1)
return button returned of result
on error number -128
return {a, b}'s item (i mod 2 + 1)
end try
end choose2
--END OF CODE 1
If you have more than two buttons, you may use 'choose from list' command like CODE 2. In AppleScript 1.10 or later, you can select a list item by typing the first few letters of its name. You may also use up and down arrow keys to navigate through the list. (After all, you need one key stroke (return/enter) to choose the default item, and two or more key strokes to choose the others.)
--CODE 2
return chooseN("Choose A or B or C", {"A", "B", "C"}, 2)
on chooseN(t, ll, i)
(*
string t: prompts
list ll : choices
integer i : default item's index in ll
return string : name of chosen item
*)
tell (choose from list ll default items (ll's item i as list) with prompt t)
if it is false then error number -128
return item 1
end tell
end chooseN
--END OF CODE 2
Hope this may be of some help,
H